From 106d3df37e6a443936ac25d76617224e920f8f34 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Mon, 30 Oct 2023 20:23:12 +0100 Subject: [PATCH] Updated to author params and GoogleAnalytics params with Hugo v0.120.0. --- layouts/_default/list.json.json | 6 +++--- layouts/_default/rss.xml | 12 ++++++------ layouts/partials/tracking.html | 5 +++-- layouts/podcast/rss.xml | 12 +++++------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index 0183baf..693a2e2 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -23,11 +23,11 @@ {{ with $.Param "favicon" -}} "favicon": "{{ . | absURL }}", {{ end -}} - {{ with site.Author.name -}} + {{ with site.Params.author.name -}} "authors": [ { - "name": "{{ . }}"{{ with site.Author.url }}, - "url": "{{ . }}"{{ end }}{{ with site.Author.avatar }}, + "name": "{{ . }}"{{ with site.Params.author.url }}, + "url": "{{ . }}"{{ end }}{{ with site.Params.author.avatar }}, "avatar": "{{ . | absURL }}"{{ end }} } ], diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 2f86d8f..4c85593 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -15,11 +15,11 @@ {{ with site.LanguageCode -}} {{ . }} {{ end -}} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} + {{ with site.Params.author.email -}} + {{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }} {{ end -}} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} + {{ with site.Params.author.email -}} + {{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }} {{ end -}} {{ with site.Copyright -}} {{ . }} @@ -35,8 +35,8 @@ {{ .Title }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} + {{ with site.Params.author.email -}} + {{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }} {{ end -}} {{ .Permalink }} {{ .Content | html }} diff --git a/layouts/partials/tracking.html b/layouts/partials/tracking.html index 3cf6614..4e318ec 100644 --- a/layouts/partials/tracking.html +++ b/layouts/partials/tracking.html @@ -1,3 +1,4 @@ +{{ $gaid := (or site.Config.Services.GoogleAnalytics.ID site.GoogleAnalytics) -}} {{ $opts := dict "minify" true "params" (dict @@ -5,7 +6,7 @@ "piwikTrackerUrl" site.Params.piwikTrackerUrl "piwikSiteID" site.Params.piwikSiteID "plausibleSiteID" site.Params.plausibleSiteID - "GoogleAnalytics" site.GoogleAnalytics) -}} + "GoogleAnalytics" $gaid) -}} {{ if eq hugo.Environment "development" -}} {{ $opts = merge $opts (dict "minify" false) -}} {{ end -}} @@ -19,7 +20,7 @@ {{ end -}} -{{ if site.GoogleAnalytics -}} +{{ if $gaid -}} {{ $script := resources.Get "js/tracking.js" | js.Build $opts | fingerprint -}} {{ template "_internal/google_analytics.html" . }} diff --git a/layouts/podcast/rss.xml b/layouts/podcast/rss.xml index a969907..7a92921 100644 --- a/layouts/podcast/rss.xml +++ b/layouts/podcast/rss.xml @@ -6,11 +6,11 @@ {{ site.Params.Podcast.Description | default site.Params.Description }} Hugo -- gohugo.io {{ site.Params.Podcast.Lang | default site.LanguageCode }} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} + {{ with site.Params.author.email -}} + {{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }} {{ end -}} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} + {{ with site.Params.author.email -}} + {{ . }}{{ with site.Params.author.name }} ({{ . }}){{ end }} {{ end -}} {{ with site.Copyright -}} {{ . }} @@ -44,9 +44,7 @@ {{ .Permalink }} {{ .Permalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with site.Author.email -}} - {{ . }}{{ with site.Author.name }} ({{ . }}){{ end }} - {{ end -}} + {{ width site.Params.Podcast.Author }}{{ . }}{{ end }} {{ .Content | html }} {{ if site.Params.Podcast.local | default true -}} {{ with .Params.podcast.mp3 }}{{ $file_stat := os.Stat (path.Join "/static" .) }}{{ end }}