Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Apr 14, 2024
1 parent 847c2dc commit 1ce78cf
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions layouts/partials/site-last-mod.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{{- /* The .Site.LastChange was deprecated in Hugo v0.123.0 */ -}}
{{- /* Use .Site.Lastmod if .Site.Hugo.Version greater than or equal to v0.123.0 */ -}}
{{- /* Otherwise, use .Site.LastChange */ -}}
{{- /*

{{- /* For more see: https://github.com/gohugoio/hugo/releases/tag/v0.123.0 */ -}}
This partial is used to get the last modification date of the site.

{{- /* Usage: {{ $siteLastMod := partial "site-last-mod.html" . }} */ -}}
In Hugo v0.123.0, the .Site.LastChange variable was deprecated in favour of .Site.Lastmod.
To maintain compatibility with older versions of Hugo, this partial checks the Hugo version.
If the version is greater than or equal to v0.123.0, it uses .Site.Lastmod.
Otherwise, it falls back to using .Site.LastChange.

The result is stored in the $siteLastMod variable and returned by the partial.

Usage:

{{ $siteLastMod := partial "site-last-mod.html" . }}

For more information, see: https://github.com/gohugoio/hugo/releases/tag/v0.123.0
*/ -}}

{{- $siteLastMod := "" -}}

Expand Down

0 comments on commit 1ce78cf

Please sign in to comment.