mirror of
https://github.com/foo-dogsquared/hugo-theme-contentful.git
synced 2025-01-30 22:57:55 +00:00
Make minor adjustments to the theme
* Remove `hidden` as one of the content frontmatter. * Adjust the post metadata output. * Update the README.
This commit is contained in:
parent
654a703d3f
commit
aa67aa0932
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
|||||||
# Edit at https://www.gitignore.io/?templates=hugo
|
# Edit at https://www.gitignore.io/?templates=hugo
|
||||||
|
|
||||||
/content/
|
/content/
|
||||||
|
/node_modules/
|
||||||
|
|
||||||
### Hugo ###
|
### Hugo ###
|
||||||
# Generated files by hugo
|
# Generated files by hugo
|
||||||
|
@ -15,6 +15,16 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
|
|||||||
* A custom empty CSS file (`assets/css/extend.css`) for easy customization of the styling.
|
* A custom empty CSS file (`assets/css/extend.css`) for easy customization of the styling.
|
||||||
|
|
||||||
|
|
||||||
|
=== Chaged
|
||||||
|
|
||||||
|
* The post metadata styling.
|
||||||
|
|
||||||
|
|
||||||
|
=== Removed
|
||||||
|
|
||||||
|
* The `hidden` frontmatter option has been removed in favor of the https://gohugo.io/content-management/build-options/[build options].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
== [2.1.0] - 2020-10-28
|
== [2.1.0] - 2020-10-28
|
||||||
|
44
README.md
44
README.md
@ -98,6 +98,8 @@ Since it is hosted on a Git repo, you can simply clone it like the following com
|
|||||||
git clone https://github.com/foo-dogsquared/hugo-theme-contentful.git themes/contentful
|
git clone https://github.com/foo-dogsquared/hugo-theme-contentful.git themes/contentful
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you intend to make major modifications for yourself, you can keep the project either as a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) (e.g., `git submodule add $GIT_REPO themes/contentful`) or as a [Git subtree](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) (e.g., `git subtree add --prefix themes/contentful http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ --squash`).
|
||||||
|
|
||||||
To try the theme out, just execute Hugo using the theme like in the following command.
|
To try the theme out, just execute Hugo using the theme like in the following command.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
@ -131,8 +133,9 @@ paginate = 20
|
|||||||
|
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
name = "John Doe"
|
[john_doe]
|
||||||
email = "johndoe@example.com"
|
name = "John Doe"
|
||||||
|
email = "johndoe@example.com"
|
||||||
|
|
||||||
|
|
||||||
[languages]
|
[languages]
|
||||||
@ -182,13 +185,27 @@ paginate = 20
|
|||||||
|
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
# Enable table of content generation (only valid for Markdown files to be parsed by Hugo's built-in parsers).
|
# Enable table of content generation (only valid for Markdown and Asciidoctor files to be parsed by Hugo's built-in parsers).
|
||||||
toc = true
|
toc = true
|
||||||
|
|
||||||
# Generate the feeds with the given number of most recent posts.
|
|
||||||
feedLimit = true
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For the author configuration, it is a map with each key holding a map value.
|
||||||
|
The value only requires `name` and you can set the structure to your own liking.
|
||||||
|
Most opt for an additional email key for web feeds.
|
||||||
|
My [web feed layout](https://github.com/foo-dogsquared/hugo-web-feeds) searches for them as well as a `url` key.
|
||||||
|
|
||||||
|
|
||||||
|
### Page configuration
|
||||||
|
|
||||||
|
Similar to the site configuration, this theme tries to minimize the use of custom parameters to be easily extensible.
|
||||||
|
Here's the exhaustive list of those parameters.
|
||||||
|
|
||||||
|
- `toc` indicates if the table of contents is to be shown.
|
||||||
|
This only works as expected for Markdown.
|
||||||
|
For other formats such as Asciidoctor-flavored files, you have to apply the attribute `toc` globally and enable the site parameter `toc`.
|
||||||
|
|
||||||
|
- `author` is similar to the site author map with the `name` as the only required key.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -207,9 +224,22 @@ This theme is inspired by the following beautiful and minimal pieces of work:
|
|||||||
|
|
||||||
## Frequently asked questions
|
## Frequently asked questions
|
||||||
|
|
||||||
|
- How to hide a post from being listed?
|
||||||
|
- You can make use of [the build options](https://gohugo.io/content-management/build-options/) with `_build.list` have a value of `never`.
|
||||||
|
Though, this is only available in Hugo v0.65.0 and above.
|
||||||
|
|
||||||
- How to extend with custom styling?
|
- How to extend with custom styling?
|
||||||
- Simply create `assets/css/extend.css` and you're on your merry way.
|
- Simply create `assets/css/extend.css` and you're on your merry way.
|
||||||
This will be concatenated with the main stylesheet so it will still be in one file.
|
This will be appended with the main stylesheet so it will still be in one file.
|
||||||
|
|
||||||
|
- Table of contents for Asciidoctor?
|
||||||
|
- You can enable it with `markup.asciidocExt.attributes.toc` set to `true` in the site config.
|
||||||
|
Then enable it with `params.toc` (e.g., `params.toc = true`) also in the site config to globally apply to all posts.
|
||||||
|
You can also enable it in your content with the `toc` frontmatter.
|
||||||
|
|
||||||
|
- Theme-specific custom shortcodes?
|
||||||
|
- No.
|
||||||
|
This theme only aims to be a skin/UI for your content so you can easily migrate your content from one theme to another.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,18 +9,17 @@ Otherwise, we take the pages of a section. */ -}}
|
|||||||
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
{{ $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ range (where (.Paginate $pages).Pages "Params.hidden" "!=" true) }}
|
{{ range (.Paginate $pages).Pages }}
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
|
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
|
||||||
<div class="post__meta">
|
<div class="post__meta">
|
||||||
<span>
|
<time datetime="{{ .Date }}">
|
||||||
<time datetime="{{ .Date }}">
|
{{ .Date.Format "2006-01-02" }}
|
||||||
{{ .Date.Format "2006-01-02" }}
|
</time>
|
||||||
</time>
|
|
||||||
{{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
|
{{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
|
||||||
(<time datetime="{{ .Lastmod }}">{{ .Lastmod.Format "2006-01-02" }}</time>)
|
<time datetime="{{ .Lastmod }}">{{ .Lastmod.Format "2006-01-02" }}</time>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</span>
|
|
||||||
|
|
||||||
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
|
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
|
||||||
{{ with .Params.author }}
|
{{ with .Params.author }}
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
|
||||||
{{- range .Data.Terms }}
|
{{- range .Data.Terms }}
|
||||||
{{- $pages := (where .Pages "Params.hidden" "!=" true) }}
|
{{- $pages := .Pages }}
|
||||||
{{- if ge (len $pages) 1 }}
|
{{- if ge (len $pages) 1 }}
|
||||||
<header id="{{ .Page.Title | urlize }}" class="taxonomy__header">
|
<header id="{{ .Page.Title | urlize }}" class="taxonomy__header">
|
||||||
<h2>{{ .Page.Title }}</h2>
|
<h2>{{ .Page.Title }}</h2>
|
||||||
<small>(<a href="{{ .Page.RelPermalink }}">Permalink</a>)</small>
|
<small>(<a href="{{ .Page.RelPermalink }}">{{ i18n "permalink" | default "Permalink" }}</a>)</small>
|
||||||
</header>
|
</header>
|
||||||
<ul class="taxonomy__pages">
|
<ul class="taxonomy__pages">
|
||||||
{{- range $pages }}
|
{{- range $pages }}
|
||||||
|
Loading…
Reference in New Issue
Block a user