summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrnh <30109443+crnh@users.noreply.github.com>2025-07-05 15:20:51 +0200
committerGitHub <noreply@github.com>2025-07-05 15:20:51 +0200
commit47ad2d183c2487539c07918763ccce3daee2b665 (patch)
tree5f0410ecee187f6d1e42596eefc17e8afcacff1a
parentff0136799bbd006cb04f6527dc9f19f1b09f1cfa (diff)
Add options to hide list dates (#115)
Add showListDate parameter, show readTime dot if date is present
-rw-r--r--layouts/_default/single.html2
-rw-r--r--layouts/partials/post-entry.html9
-rw-r--r--wiki/features/collections.md9
3 files changed, 14 insertions, 6 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 4398ce5..0538658 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -34,7 +34,7 @@
{{- end }}
{{- if .Param "readTime" }}
- &nbsp; · &nbsp;
+ {{ if .Date }}&nbsp; · &nbsp;{{ end }}
{{- .ReadingTime }} min read
{{- end }}
</p>
diff --git a/layouts/partials/post-entry.html b/layouts/partials/post-entry.html
index 1f57f23..ac1386b 100644
--- a/layouts/partials/post-entry.html
+++ b/layouts/partials/post-entry.html
@@ -1,11 +1,10 @@
<div class="post-line">
- {{ $dateFormat := "2 Jan 2006"}}
- {{ with .Site.Params.listDateFormat }}
- {{ $dateFormat = .}}
- {{ end }}
+ {{ $dateFormat := .Site.Params.listDateFormat | default "2 Jan 2006" }}
- <p class="line-date">{{ .Date | time.Format $dateFormat }} </p>
+ {{ if .Parent.Param "showListDate" | default true }}
+ <p class="line-date">{{ .Date | time.Format $dateFormat }} </p>
+ {{ end }}
<div>
<p class="line-title">
diff --git a/wiki/features/collections.md b/wiki/features/collections.md
index afc6394..8a1fa79 100644
--- a/wiki/features/collections.md
+++ b/wiki/features/collections.md
@@ -38,3 +38,12 @@ Summaries can be turned on and off with this setting.
[params]
listSummaries = true
```
+
+## Hide List Date
+
+To hide the dates on the list page, add the following to the frontmatter of the collection's `_index.md`:
+
+```toml
+[params]
+showListDate = false
+``` \ No newline at end of file