Skip to content

Commit

Permalink
Use time.Format function instead of .Format method
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeso committed Jan 19, 2024
1 parent 843c484 commit 01ad7fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
{{ .PublishDate.Format "2006-01-02" }} – <a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ time.Format "2006-01-02" .PublishDate }} – <a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<managingEditor>{{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with site.Params.author.email }}
<webMaster>{{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ with .Date | default nil }}
<lastBuildDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .OutputFormats.Get "RSS" }}
<lastBuildDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" . | safeHTML }}</lastBuildDate>{{ end }}{{ with .OutputFormats.Get "RSS" }}
{{ printf `<atom:link rel="self" href=%q type=%q />` .Permalink .MediaType.Type | safeHTML }}{{ end }}{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>{{ with .PublishDate | default nil }}
<pubDate>{{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>{{ end }}{{ with site.Params.author.email }}
<pubDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" . | safeHTML }}</pubDate>{{ end }}{{ with site.Params.author.email }}
<author>{{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ html .Content }}</description>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/heading.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ <h2 class="Heading-title">
<a class="Heading-link u-clickable" href="{{ .RelPermalink }}" rel="bookmark">{{ .Title }}</a>
</h2>
{{ with .PublishDate | default nil }}
<time datetime="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Format "2 January, 2006" -}}
<time datetime="{{ time.Format "2006-01-02T15:04:05Z07:00" . }}">
{{- time.Format ":date_long" . -}}
</time>
{{ end }}
</header>

0 comments on commit 01ad7fd

Please sign in to comment.