Commit 5b4d1408 authored by Kaushal Modi's avatar Kaushal Modi
Browse files

Use publishdate from frontmatter as post date if available

parent 31879f2e
......@@ -12,7 +12,7 @@
</span>
<span class="left post-date">
{{ .Date.Format .Site.Params.DateForm }}
{{ partial "publishdate-maybe" . }}
</span>
<span class="right">
......
......@@ -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>
......
......@@ -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>
......
......@@ -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" >
......
{{ 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 }}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment