Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mismith0227/hugo_theme_pickles.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Kerr <dwmkerr@gmail.com>2020-06-11 11:07:22 +0300
committerDave Kerr <dwmkerr@gmail.com>2020-06-18 08:15:07 +0300
commit1dfa6426bee137c4ae9d0aa993c31cc72da05299 (patch)
tree6d3e3177196f480fbc75a39f14287d9727a2630c
parentd12aafb104cca1cc4614875842968ea1c59f5173 (diff)
feat: add 'hideDate' parameter to hide the date
This closes issue #71.
-rw-r--r--README.md10
-rwxr-xr-xexampleSite/content/posts/hiding-the-date.md27
-rwxr-xr-xlayouts/_default/single.html8
3 files changed, 42 insertions, 3 deletions
diff --git a/README.md b/README.md
index 9043067..0e38635 100644
--- a/README.md
+++ b/README.md
@@ -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 }}