From 77b73fceb49bff397dab6badb7df8e821960fe2b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 14 Apr 2024 14:15:06 +0200 Subject: [PATCH] Update documentation --- layouts/partials/site-last-mod.html | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/layouts/partials/site-last-mod.html b/layouts/partials/site-last-mod.html index 1b422b2..6e25657 100644 --- a/layouts/partials/site-last-mod.html +++ b/layouts/partials/site-last-mod.html @@ -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 := "" -}}