Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Kaushal Modi
hugo-theme-refined
Commits
5b4d1408
Commit
5b4d1408
authored
Jan 16, 2017
by
Kaushal Modi
Browse files
Use publishdate from frontmatter as post date if available
parent
31879f2e
Changes
5
Hide whitespace changes
Inline
Side-by-side
layouts/_default/li.html
View file @
5b4d1408
...
...
@@ -12,7 +12,7 @@
</span>
<span
class=
"left post-date"
>
{{
.Date.Format .Site.Params.DateForm
}}
{{
partial "publishdate-maybe" .
}}
</span>
<span
class=
"right"
>
...
...
layouts/_default/rss.xml
View file @
5b4d1408
...
...
@@ -9,7 +9,7 @@
{{ with .Site.LanguageCode }}
<language>
{{.}}
</language>
{{ end }}
{{ with .Site.Author.name }}
<author>
{{.}}
</author>
{{ end }}
{{ with .Site.Copyright }}
<copyright>
{{.}}
</copyright>
{{end}}
{{ if not .Date.IsZero }}
<lastBuildDate>
{{
.Date
.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
</lastBuildDate>
{{ end }}
<lastBuildDate>
{{
now
.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
</lastBuildDate>
<atom:link
href=
"{{.URL}}"
rel=
"self"
type=
"application/rss+xml"
/>
...
...
@@ -19,7 +19,14 @@
<item>
<title>
{{ .Title }}
</title>
<link>
{{ .Permalink }}
</link>
<pubDate>
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
</pubDate>
<pubDate>
{{ if eq (.PublishDate.Format "2006-01-02") "0001-01-01" }}
<!-- Print the Date instead of PublishDate if PublishDate is defined but at its initial value of Jan 1, 0001 -->
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
{{ else }}
{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
{{ end }}
</pubDate>
{{ with .Site.Author.name }}
<author>
{{.}}
</author>
{{ end }}
<guid>
{{ .Permalink }}
</guid>
<description>
{{ .Content | html }}
</description>
...
...
layouts/_default/single.html
View file @
5b4d1408
...
...
@@ -2,7 +2,7 @@
<div
class=
"post"
>
<h1
class=
"post-title"
>
{{ .Title }}
</h1>
<span
class=
"post-date"
>
{{
.Date.Format .Site.Params.DateForm
}}
</span>
<span
class=
"post-date"
>
{{
partial "publishdate-maybe" .
}}
</span>
{{ .Content }}
</div>
...
...
layouts/_default/summary.html
View file @
5b4d1408
...
...
@@ -12,7 +12,7 @@
<article
class=
"summary"
>
<header>
<h1
class=
"post-title"
><a
href=
'{{ .Permalink }}'
>
{{ .Title }}
</a>
</h1>
<div
class=
"post-date"
>
{{
.Date.Format .Site.Params.DateForm
}} - {{ .FuzzyWordCount }} Words
</div>
<div
class=
"post-date"
>
{{
partial "publishdate-maybe" .
}} - {{ .FuzzyWordCount }} Words
</div>
</header>
<div
class=
"post"
>
...
...
layouts/partials/publishdate-maybe.html
0 → 100644
View file @
5b4d1408
{{ with .PublishDate }}
{{ if eq ($.PublishDate.Format "2006-01-02") "0001-01-01" }}
<!-- Print the Date instead of PublishDate if PublishDate is defined but at its initial value of Jan 1, 0001 -->
{{ $.Date.Format $.Site.Params.DateForm }}
{{ else }}
{{ $.PublishDate.Format $.Site.Params.DateForm }}
{{ end }}
{{ else }}
{{ $.Date.Format $.Site.Params.DateForm }}
{{ end }}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment