mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-02-12 06:19:03 +00:00
Update datetime metadata
It is closer to the specification at the following document: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-global-date-and-time-string
This commit is contained in:
parent
c5b03ae623
commit
d283b2babb
@ -24,6 +24,8 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
|
|||||||
|
|
||||||
- Revert the site layout.
|
- Revert the site layout.
|
||||||
|
|
||||||
|
- Update the datetime string for the appropriate components.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
<!-- 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="{{ .PublishDate }}">{{ i18n "published_on" }}: <time datetime="{{ .PublishDate.Format "2006-01-02" }}">{{ .PublishDate.Format "2006-01-02" }}</time></p>
|
<p data-content-publication-date="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}">{{ i18n "published_on" }}: <time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}">{{ .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 .PublishDate .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.Format "2006-01-02T15:04:05Z07:00" }}">{{ i18n "updated_on" }}: <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time></p>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
<!-- Link the translated versions if the article has at least one translated page. -->
|
<!-- Link the translated versions if the article has at least one translated page. -->
|
||||||
|
@ -2,19 +2,24 @@
|
|||||||
The component where it will display the metadata of the post.
|
The component where it will display the metadata of the post.
|
||||||
This is used on list templates but feel free to change that.
|
This is used on list templates but feel free to change that.
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
{{- $RFC3339 := "2006-01-02T15:04:05Z07:00" }}
|
||||||
<div class="list post__meta" aria-hidden="true">
|
<div class="list post__meta" aria-hidden="true">
|
||||||
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
{{- if ne (.PublishDate.Format "2006") "0001" -}}
|
||||||
<time datetime="{{ .PublishDate }}" title="{{ i18n "published_on" }}">
|
<span>
|
||||||
{{ partial "components/heroicon.html" "calendar" }}
|
{{ partial "components/heroicon.html" "calendar" }}
|
||||||
<span style="margin-left: 0.5em;">{{ .PublishDate.Format "2006-01-02" }}</span>
|
<time datetime="{{ .PublishDate.Format $RFC3339 }}" title="{{ i18n "published_on" }}" style="margin-left: 0.5em;">
|
||||||
|
{{ .PublishDate.Format "2006-01-02" }}
|
||||||
</time>
|
</time>
|
||||||
|
</span>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .GitInfo (ne (.PublishDate.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 }}" title="{{ i18n "updated_on" }}">
|
<span>
|
||||||
{{ partial "components/heroicon.html" "arrow-path" }}
|
{{ partial "components/heroicon.html" "arrow-path" }}
|
||||||
<span style="margin-left: 0.5em;">{{ .Lastmod.Format "2006-01-02" }}</span>
|
<time datetime="{{ .Lastmod.Format $RFC3339 }}" title="{{ i18n "updated_on" }}" style="margin-left: 0.5em;">
|
||||||
|
{{ .Lastmod.Format "2006-01-02" }}
|
||||||
</time>
|
</time>
|
||||||
|
</span>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
|
{{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}}
|
||||||
|
Loading…
Reference in New Issue
Block a user