mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-02-07 12:19:26 +00:00
Change all '.Date' into '.PublishDate'
This commit is contained in:
parent
9487442d64
commit
22069d21b6
@ -19,6 +19,12 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
|
|||||||
|
|
||||||
== [Unreleased]
|
== [Unreleased]
|
||||||
|
|
||||||
|
=== Changed
|
||||||
|
|
||||||
|
* All references to `.Date` are changed with `.PublishDate` as it is more reliable.
|
||||||
|
The `.PublishDate` can be manually set with the `publishdate` frontmatter variable and if unset, it is the assumed to be the `date` variable.
|
||||||
|
|
||||||
|
|
||||||
=== Fixed
|
=== Fixed
|
||||||
|
|
||||||
* Make a few tweaks with CSS.
|
* Make a few tweaks with CSS.
|
||||||
|
@ -9,7 +9,7 @@ Otherwise, we take the pages of a section. */ -}}
|
|||||||
{{- $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
{{- $pages = where $.Site.RegularPages "Type" "in" $.Site.Params.mainSections }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- range (where (.Paginate $pages).Pages "Params.hidden" "!=" true) }}
|
{{- range (.Paginate $pages).Pages }}
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
|
<h1><a href="{{ .Permalink }}" aria-label="{{ .Title }}">{{ .Title }}</a></h1>
|
||||||
{{ partial "partials/components/post-meta.html" . }}
|
{{ partial "partials/components/post-meta.html" . }}
|
||||||
|
@ -33,11 +33,11 @@
|
|||||||
<!-- Only show the creation date if the `date` field is valid. -->
|
<!-- Only show the creation date if the `date` field is valid. -->
|
||||||
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
||||||
<!-- Publication date. -->
|
<!-- Publication date. -->
|
||||||
<p data-content-publication-date="{{ .Date }}">{{ i18n "published_on" }}: <time datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time></p>
|
<p data-content-publication-date="{{ .PublishDate }}">{{ i18n "published_on" }}: <time datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time></p>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
<!-- Modification date (will only appear if the publication date is less than the modified date.) -->
|
<!-- Modification date (will only appear if the publication date is less than the modified date.) -->
|
||||||
{{- if ne .Date .Lastmod }}
|
{{- if ne .PublishDate .Lastmod }}
|
||||||
<p data-content-modification-date="{{ .Lastmod }}">{{ i18n "updated_on" }}: <time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></p>
|
<p data-content-modification-date="{{ .Lastmod }}">{{ i18n "updated_on" }}: <time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></p>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ If the partial is short enough, it should be put here.
|
|||||||
|
|
||||||
{{- define "partials/components/post-meta.html" }}
|
{{- define "partials/components/post-meta.html" }}
|
||||||
<div class="list post__meta">
|
<div class="list post__meta">
|
||||||
{{- if ne (.Date.Format "2006") "0001" -}}
|
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
||||||
<time datetime="{{ .Date }}">
|
<time datetime="{{ .PublishDate }}">
|
||||||
{{ partial "components/heroicon.html" "calendar" }}
|
{{ partial "components/heroicon.html" "calendar" }}
|
||||||
<span style="margin-left: 0.5em;">{{ .Date.Format "2006-01-02" }}</span>
|
<span style="margin-left: 0.5em;">{{ .PublishDate.Format "2006-01-02" }}</span>
|
||||||
</time>
|
</time>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
|
{{- if and .GitInfo (ne (.PublishDate.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }}
|
||||||
<time datetime="{{ .Lastmod }}">
|
<time datetime="{{ .Lastmod }}">
|
||||||
{{ partial "components/heroicon.html" "refresh" }}
|
{{ partial "components/heroicon.html" "refresh" }}
|
||||||
<span style="margin-left: 0.5em;">{{ .Lastmod.Format "2006-01-02" }}</span>
|
<span style="margin-left: 0.5em;">{{ .Lastmod.Format "2006-01-02" }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user