Skip to content

Commit

Permalink
fix: give precedence to date created over last modified if defined (#…
Browse files Browse the repository at this point in the history
…101)
  • Loading branch information
jackyzha0 committed Jul 15, 2022
1 parent dff5ae0 commit e15e391
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ If you prefer browsing the contents of this site through a list instead of a gra
- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
- 👀 [Discord Community](https://discord.gg/cRFFHYye7t)

2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<article>
{{if .Title}}<h1>{{ .Title }}</h1>{{end}}
<p class="meta">
Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}.
Last updated {{ partial "date-fmt.html" .}}
{{ partial "github.html" . }}
</p>
<ul class="tags">
Expand Down
7 changes: 7 additions & 0 deletions layouts/partials/date-fmt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{if .Date}}
{{.Date.Format "Jan 2, 2006"}}
{{else if .Lastmod}}
{{.Lastmod.Format "Jan 2, 2006"}}
{{else}}
Unknown
{{end}}
2 changes: 1 addition & 1 deletion layouts/partials/page-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<li class="section-li">
<div class="section">
<p class="meta">
{{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
{{partial "date-fmt.html" .}}
</p>
<div class="desc">
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
Expand Down

0 comments on commit e15e391

Please sign in to comment.