added post param to hide date from single post view

This commit is contained in:
Gabriele Musco 2021-07-06 23:17:14 +02:00
parent 35cdd183eb
commit f9c98de489
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
3 changed files with 15 additions and 12 deletions

View File

@ -272,6 +272,7 @@ Every post can have various parameters in the frontmatter, here are some that yo
- `tags`: a list of tags for your post
- `image`: a link to a feature image for the article, shown in the preview as well
- `comments`: boolean, if true it enables comments for the current post, if false it disables them (default is true)
- `showDate`: boolean, true by default, if false hides the date. Useful for non-article pages where the date isn't important
# Does *Ficurinia* mean anything?

View File

@ -2,10 +2,12 @@
{{- partial "inject/content-before.html" . -}}
<article class="card {{ if .Site.Params.discreteCards }}discrete{{ end }} single">
<h1>{{ .Title }}</h1>
<p class="date">
<span title="Date"></span>
{{ .Date.Format "2006-01-02" }}
</p>
{{ if (.Params.showDate | default true) }}
<p class="date">
<span title="Date"></span>
{{ .Date.Format "2006-01-02" }}
</p>
{{ end }}
{{ if .Params.Image }}
<img src="{{ .Params.Image }}" alt="" />
{{ end }}

View File

@ -4,15 +4,15 @@
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
<p class="date">
<span title="Date"></span>
{{ .Date.Format "2006-01-02" }}
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
| <!-- Pipe character as visual separator between date and tags-->
<span title="Tags"></span>
{{ range sort .Params.tags }}
<a href="/tags/{{ . | urlize }}">#{{ . }}</a>
<span title="Date"></span>
{{ .Date.Format "2006-01-02" }}
{{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }}
| <!-- Pipe character as visual separator between date and tags-->
<span title="Tags"></span>
{{ range sort .Params.tags }}
<a href="/tags/{{ . | urlize }}">#{{ . }}</a>
{{ end }}
{{ end }}
{{ end }}
</p>
{{ if .Site.Params.imageInArticlePreview }}
{{ if .Params.Image }}