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

github.com/xiaoheiAh/hugo-theme-pure.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryx.z <xiaohei.zyx@gmail.com>2019-12-31 05:34:48 +0300
committerGitHub <noreply@github.com>2019-12-31 05:34:48 +0300
commit01a94577a4481398008925dbd1ecb124a96aee03 (patch)
tree88951962e3268d4c877ef0d912b9e66bac77a66d /layouts
parent64f4dcd55a5cc79f07b30c30418a9b0967ad1849 (diff)
parent98541ccb10bd6dcf3b445b39bffa3b99c98347da (diff)
Merge pull request #62 from ssbarnea/master2
Avoid printing undefined dates
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/item-post.html5
-rw-r--r--layouts/partials/post/date.html4
2 files changed, 7 insertions, 2 deletions
diff --git a/layouts/partials/item-post.html b/layouts/partials/item-post.html
index d7a58a3..cc289d2 100644
--- a/layouts/partials/item-post.html
+++ b/layouts/partials/item-post.html
@@ -1,5 +1,8 @@
<a href="{{- .Permalink }}" class="collection-item" itemprop="url" target="_blank" >
<time datetime="{{ .Date }}"
- itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
+ itemprop="datePublished">
+ {{ if .Date }}
+ {{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
+ {{ end }}</time>
<span>&nbsp;&nbsp;&nbsp;</span> {{- .Title }}
</a> \ No newline at end of file
diff --git a/layouts/partials/post/date.html b/layouts/partials/post/date.html
index e24600f..b440287 100644
--- a/layouts/partials/post/date.html
+++ b/layouts/partials/post/date.html
@@ -1,6 +1,8 @@
+{{ if .Date }}
<span class="article-date">
<i class="icon icon-calendar-check"></i>
<a href="{{- .Permalink }}" class="{{ .Scratch.Get "class_name" }}">
<time datetime="{{ .Date }}" itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
</a>
-</span> \ No newline at end of file
+</span>
+{{ end }} \ No newline at end of file