From a3d507d98b87a4bb306486df818b6102c1e483da Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Thu, 4 Apr 2024 19:14:31 +0300 Subject: [PATCH] Display toha theme version in footer --- layouts/partials/footer.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 80cd35b..9c0eb20 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,6 +6,17 @@ {{ $newsletterEnabled := site.Params.footer.newsletter.enable | default true }} {{ $credentialsEnabled := site.Params.footer.credentials.enable | default true }} {{ $disclaimerEnabled := site.Params.footer.disclaimer.enable | default false }} +{{ $tohaVersion := "v4" }} + +{{- $goModContent := readFile "go.mod" -}} +{{- $lines := split $goModContent "\n" -}} +{{- range $lines -}} + {{- $line := trim . " " -}} + {{- if hasPrefix $line "require github.com/hugo-toha/toha/v4" -}} + {{- $parts := split $line " " -}} + {{- $tohaVersion = index $parts 2 -}} + {{- end -}} +{{- end -}} {{/* Keep backward compatibility for the newsletter function */}} {{ if site.Params.newsletter }} @@ -197,7 +208,7 @@
Toha Theme Logo - Toha + Toha theme {{ $tohaVersion }}
{{ replace $copyrightNotice "{year}" now.Year | markdownify }}