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:
authorSorin Sbarnea <ssbarnea@redhat.com>2019-12-30 16:57:07 +0300
committerSorin Sbarnea <ssbarnea@redhat.com>2019-12-30 17:29:00 +0300
commit98541ccb10bd6dcf3b445b39bffa3b99c98347da (patch)
tree6eb782375cffb266b0b5ae9b3de64375cfeac7d0
parent31b94ccd426fa90215f5ceb2a645ca3343647cad (diff)
Avoid printing undefined dates
- Invalid date should render as empty string - Assures cotegory listing has consisten indentation Fixes: #59
-rw-r--r--layouts/partials/item-post.html5
-rw-r--r--layouts/partials/post/date.html4
-rw-r--r--static/css/style.css6
3 files changed, 13 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
diff --git a/static/css/style.css b/static/css/style.css
index f642324..02930ad 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -9433,3 +9433,9 @@ body.okayNav-loaded {
max-height: 200px;
}
}
+
+/* Assures listing in categories indentiation is consistent */
+time {
+ width: 10ch;
+ display: inline-block;
+} \ No newline at end of file