Min version is now v0.124.0. Using site.Config.Services.GoogleAnalytics.ID, hugo.IsMultilingual and hugo.yaml etc.

This commit is contained in:
Fredrik Jonsson 2024-08-14 14:27:12 +02:00
commit 2ae8ee84ee
7 changed files with 9 additions and 10 deletions

42
exampleSite/hugo.yaml Normal file
View file

@ -0,0 +1,42 @@
---
title: "Hugo Zen theme"
baseURL: "https://example.org/"
theme: "zen"
languageCode: "en-GB"
defaultContentLanguage: "en"
pluralizelisttitles: false
removePathAccents: true
paginate: 10
paginatePath: "page"
rssLimit: 20
outputFormats:
SearchIndex:
mediaType: "application/json"
baseName: "searchindex"
isPlainText: true
notAlternative: true
outputs:
home: ["HTML","RSS", "JSON", "SearchIndex"]
section: ["HTML","RSS", "JSON"]
params:
contact: "info@example.org"
description: "The zen theme for Hugo example site."
dateformat: "2 January, 2006"
favicon: "apple-touch-icon.png"
feedlinks: true
icon: "apple-touch-icon.png"
image: "apple-touch-icon.png"
imageMaxWidth: 400
logoWidth: 64
mobileMenu: true
poweredby: true
realfavicongenerator: true
sidebar: true
submitted: true
author:
name: "Your Name"
url: "https://example.org/somepage"
avatar: "path/to/some-image.jpg"

4
hugo.yaml Normal file
View file

@ -0,0 +1,4 @@
module:
hugoVersion:
extended: true
min: "0.124.0"

View file

@ -28,7 +28,7 @@
<a href="{{ site.Home.RelPermalink }}" title="Home" class="header__site-link" rel="home"><span>{{ site.Title }}</span></a>
</h1>
<div class="region header__region">
{{ if site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end -}}
{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end -}}
{{ if $.Param "menuinheader" }}{{ partial "menu.html" . }}{{ end -}}
</div>
</header>

View file

@ -9,7 +9,7 @@
</svg>
</button>
<div class="mobile-nav__sheet link-inverted link-nav" id="sheet" aria-hidden="true">
<div class="mobile-nav__region">{{ if site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end }}</div>
<div class="mobile-nav__region">{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end }}</div>
<nav class="mobile-nav__main-menu" aria-label="{{ i18n "menu_title" }}">
<ul class="mobile-nav__navbar">
{{ if site.Menus.main -}}

View file

@ -1,4 +1,3 @@
{{ $gaid := (or site.Config.Services.GoogleAnalytics.ID site.GoogleAnalytics) -}}
{{ $opts := dict
"minify" true
"params" (dict
@ -6,7 +5,7 @@
"piwikTrackerUrl" site.Params.piwikTrackerUrl
"piwikSiteID" site.Params.piwikSiteID
"plausibleSiteID" site.Params.plausibleSiteID
"GoogleAnalytics" $gaid) -}}
"GoogleAnalytics" site.Config.Services.GoogleAnalytics.ID) -}}
{{ if eq hugo.Environment "development" -}}
{{ $opts = merge $opts (dict "minify" false) -}}
{{ end -}}
@ -20,7 +19,7 @@
<script async defer data-domain="{{ site.Params.plausibleSiteID }}" src="{{ site.Params.plausibleTrackerURL | default "https://plausible.io/js/plausible.js" }}"></script>
{{ end -}}
{{ if $gaid -}}
{{ if site.Config.Services.GoogleAnalytics.ID -}}
{{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}}
<script src="{{ $script.RelPermalink }}"></script>
{{ template "_internal/google_analytics.html" . }}

View file

@ -22,7 +22,7 @@ copy_files=("themes/zen/assets/sass/_colors.scss:assets/sass/_colors.scss"
"themes/zen/assets/sass/_custom.scss:assets/sass/_custom.scss"
"themes/zen/assets/sass/_zen.scss:assets/sass/_zen.scss"
"themes/zen/layouts/index.html:layouts/index.html"
"themes/zen/exampleSite/config.yaml:config.yaml"
"themes/zen/exampleSite/hugo.yaml:hugo.yaml"
"themes/zen/.editorconfig:.editorconfig")
for files in "${copy_files[@]}" ; do
@ -34,6 +34,6 @@ for files in "${copy_files[@]}" ; do
fi
done
if [[ -f "config.toml" && -f "config.yaml" ]]; then
mv config.toml config.toml.old
if [[ -f "hugo.toml" && -f "hugo.yaml" ]]; then
mv hugo.toml hugo.toml.old
fi

View file

@ -6,7 +6,7 @@ license = "GPLv2"
licenselink = "http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"
tags = ["accessible", "multilingual", "responsive", "blog", "search", "math", "podcast"]
features = ["accessible", "multilingual", "responsive", "grid", "sass", "search", "matomo", "jsonfeed", "math", "podcast"]
min_version = "0.93.0"
min_version = "0.124.0"
[author]
name = "Fredrik Jonsson"