diff options
author | Dave Kerr <dwmkerr@gmail.com> | 2020-06-11 11:07:22 +0300 |
---|---|---|
committer | Dave Kerr <dwmkerr@gmail.com> | 2020-06-18 08:15:07 +0300 |
commit | 1dfa6426bee137c4ae9d0aa993c31cc72da05299 (patch) | |
tree | 6d3e3177196f480fbc75a39f14287d9727a2630c | |
parent | d12aafb104cca1cc4614875842968ea1c59f5173 (diff) |
feat: add 'hideDate' parameter to hide the date
This closes issue #71.
-rw-r--r-- | README.md | 10 | ||||
-rwxr-xr-x | exampleSite/content/posts/hiding-the-date.md | 27 | ||||
-rwxr-xr-x | layouts/_default/single.html | 8 |
3 files changed, 42 insertions, 3 deletions
@@ -65,6 +65,16 @@ $ cp themes/hugo_theme_pickles/exampleSite/config.toml . Now, you can start editing this file and add your own information! +## Customisation + +To hide the date in any page or post, set the `hideDate` parameter in the front matter: + +``` +--- +hideDate: true +--- +``` + ## Contributing Pull requests, bug fixes and new features are welcome! diff --git a/exampleSite/content/posts/hiding-the-date.md b/exampleSite/content/posts/hiding-the-date.md new file mode 100755 index 0000000..94bf60b --- /dev/null +++ b/exampleSite/content/posts/hiding-the-date.md @@ -0,0 +1,27 @@ +--- +author: "Dave Kerr" +date: 2020-06-11 +linktitle: Hiding the Date +title: Hiding the Date +weight: 10 +hideDate: true +--- + + +## Introduction + +Hiding the date in a page or post is easy! Just set `hideDate` to `true` in your front matter. + +As an example, the front matter for this page is: + +``` +--- +date: 2020-06-11 +linktitle: Hiding the Date +title: Hiding the Date +weight: 10 +hideDate: true +--- +``` + +Piece of cake! diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1a53fc9..6456e63 100755 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,9 +4,11 @@ <header> <h1>{{ .Title }}</h1> <div> - <div class="c-time"> - {{ partial "timestamp.html" . }} - </div> + {{ if not .Params.hideDate }} + <div class="c-time"> + {{ partial "timestamp.html" . }} + </div> + {{ end }} {{ range .Params.tags }} <a href="{{ $baseurl }}/tags/{{ . | urlize }}" class="c-tag">{{ . }}</a> {{ end }} |