- Hide date part in posts if no date is given
This commit is contained in:
Vicky 2018-09-16 12:22:05 +09:00
parent 2f8e809667
commit 7bb579950a
5 changed files with 10 additions and 4 deletions

View file

@ -0,0 +1,6 @@
---
title: "Undated post"
tags: ["words"]
---
I was born yesterday, tomorrow.

View file

@ -6,7 +6,7 @@
{{ if .Site.Params.home.showLatest | default true }}
<h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 .Pages.ByPublishDate.Reverse }}
<div class="summary">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}
<div class="summary">{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}{{ end }}
<h3 class="title is-3 strong-post-title">
<a href="{{ .Permalink }}">
{{ .Title }}

View file

@ -10,7 +10,7 @@
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
<div class="post-data">
{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} |
{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} |{{ end }}
{{ i18n "blog_readingTime" .ReadingTime }}
</div>
{{ if or .Site.Params.share.twitter .Site.Params.share.facebook .Site.Params.share.pinterest .Site.Params.share.googlePlus }}

View file

@ -1,5 +1,5 @@
{{ range .Pages.ByPublishDate.Reverse }}
<li class="post-item">
<span><a href="{{ .Permalink }}">{{ .Title }}</a></span> - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span>
<span><a href="{{ .Permalink }}">{{ .Title }}</a></span>{{ if .Params.date }} - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span>{{ end }}
</li>
{{ end }}

View file

@ -5,7 +5,7 @@
{{ if .Site.Params.home.showLatest | default true }}
<h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 .Pages.ByPublishDate.Reverse }}
<div class="summary">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}
<div class="summary">{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}{{ end }}
<h3 class="title is-3 latest-post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
<div class="markdown">
{{ .Summary }}