From 3737d5874ce3653cb626419f13785f3af648892e Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Tue, 21 Dec 2021 18:52:39 +0100 Subject: [PATCH] Replace .Site.x and $.Site.x with site.x. --- layouts/_default/baseof.html | 12 +++---- layouts/_default/list.json.json | 16 ++++----- layouts/_default/rss.xml | 22 ++++++------ layouts/home.searchindex.json | 2 +- layouts/index.html | 4 +-- layouts/micro/list.json.json | 12 +++---- layouts/micro/rss.xml | 16 ++++----- layouts/partials/cookieconsent.html | 2 +- layouts/partials/language-selector.html | 4 +-- layouts/partials/menu.html | 10 +++--- layouts/partials/meta.html | 4 +-- layouts/partials/meta_json_ld.html | 6 ++-- layouts/partials/mobilemenu.html | 12 +++---- layouts/partials/podcast.html | 6 ++-- layouts/partials/related.html | 2 +- layouts/partials/sidebar.html | 2 +- layouts/partials/tracking.html | 10 +++--- layouts/podcast/rss.xml | 46 ++++++++++++------------- layouts/shortcodes/figure.html | 2 +- layouts/shortcodes/img.html | 2 +- scripts/set_up_new_site.sh | 5 +-- 21 files changed, 99 insertions(+), 98 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5c36272..22f0466 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,9 @@ - + -{{ block "title" . }}{{ .Title }} – {{ .Site.Title }}{{ end }} +{{ block "title" . }}{{ .Title }} – {{ site.Title }}{{ end }} {{ partial "meta.html" . }} {{ partialCached "styles.html" . }} {{- block "head" . }}{{ end }} @@ -12,15 +12,15 @@ {{ partialCached "tracking.html" . }} - +
{{ if $.Param "logo" | default true }}{{ end }}

-{{ .Site.Title }} +{{ site.Title }}

-{{ if .Site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end -}} +{{ if site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end -}}
@@ -32,7 +32,7 @@
{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}} -

{{ with $.Param "copyright" }}{{ . | markdownify }}{{ else }}© {{ .Site.Title }}{{ end }}

+

{{ with $.Param "copyright" }}{{ . | markdownify }}{{ else }}© {{ site.Title }}{{ end }}

{{ with $.Param "footer" }}

{{ . | markdownify }}

{{ end }} {{ if $.Param "poweredby" }}

Powered by Hugo and the Zen theme.

{{ end }}
diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index 264ea51..0183baf 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -1,20 +1,20 @@ {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- $pages := $pctx.RegularPages -}} -{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- $limit := site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} {{ $length := (len $pages) -}} { "version": "https://jsonfeed.org/version/1.1", - "title": "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}", - "description": "{{ i18n "string_recent_content" }} {{ if ne .Title .Site.Title }}{{ with .Title }}{{ i18n "string_in" }} {{ . }} {{ end }}{{ end }}{{ i18n "string_on" }} {{ .Site.Title }}", - "home_page_url": "{{ .Site.BaseURL }}", + "title": "{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ site.Title }}{{ end }}", + "description": "{{ i18n "string_recent_content" }} {{ if ne .Title site.Title }}{{ with .Title }}{{ i18n "string_in" }} {{ . }} {{ end }}{{ end }}{{ i18n "string_on" }} {{ site.Title }}", + "home_page_url": "{{ site.BaseURL }}", {{ with .OutputFormats.Get "JSON" -}} "feed_url": "{{ .Permalink }}", {{ end -}} - {{ with .Site.LanguageCode -}} + {{ with site.LanguageCode -}} "language": "{{ . }}", {{ end -}} {{ with $.Param "icon" -}} @@ -23,11 +23,11 @@ {{ with $.Param "favicon" -}} "favicon": "{{ . | absURL }}", {{ end -}} - {{ with .Site.Author.name -}} + {{ with site.Author.name -}} "authors": [ { - "name": "{{ . }}"{{ with $.Site.Author.url }}, - "url": "{{ . }}"{{ end }}{{ with $.Site.Author.avatar }}, + "name": "{{ . }}"{{ with site.Author.url }}, + "url": "{{ . }}"{{ end }}{{ with site.Author.avatar }}, "avatar": "{{ . | absURL }}"{{ end }} } ], diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index c4f6695..9a068f6 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,27 +1,27 @@ {{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- $pages := $pctx.RegularPages -}} -{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- $limit := site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} {{- printf "" | safeHTML }} - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }} + {{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ site.Title }}{{ end }} {{ .Permalink }} - {{ i18n "string_recent_content" }} {{ if ne .Title .Site.Title }}{{ with .Title }}{{ i18n "string_in" }} {{ . }} {{ end }}{{ end }}{{ i18n "string_on" }} {{ .Site.Title }} + {{ i18n "string_recent_content" }} {{ if ne .Title site.Title }}{{ with .Title }}{{ i18n "string_in" }} {{ . }} {{ end }}{{ end }}{{ i18n "string_on" }} {{ site.Title }} Hugo -- gohugo.io - {{ with .Site.LanguageCode -}} + {{ with site.LanguageCode -}} {{ . }} {{ end -}} - {{ with .Site.Author.email -}} - {{ . }}{{ with $.Site.Author.name }} ({{ . }}){{end}} + {{ with site.Author.email -}} + {{ . }}{{ with site.Author.name }} ({{ . }}){{end}} {{ end -}} - {{ with .Site.Author.email -}} - {{ . }}{{ with $.Site.Author.name }} ({{ . }}){{end}} + {{ with site.Author.email -}} + {{ . }}{{ with site.Author.name }} ({{ . }}){{end}} {{ end -}} - {{ with .Site.Copyright -}} + {{ with site.Copyright -}} {{ . }} {{ end -}} {{ if not .Date.IsZero -}} @@ -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.Author.email -}} + {{ . }}{{ with site.Author.name }} ({{ . }}){{end}} {{ end -}} {{ .Permalink }} {{ .Content | html }} diff --git a/layouts/home.searchindex.json b/layouts/home.searchindex.json index cc83383..b45ee56 100644 --- a/layouts/home.searchindex.json +++ b/layouts/home.searchindex.json @@ -1,5 +1,5 @@ {{- $.Scratch.Add "searchindex" slice -}} -{{- range $index, $element := .Site.RegularPages -}} +{{- range $index, $element := where site.RegularPages "Params.exclude_search" nil -}} {{- $.Scratch.Add "searchindex" (dict "id" $index "title" $element.Title "permalink" $element.RelPermalink "tags" (delimit ($element.Params.tags | default "") " ") "content" $element.Plain "summary" $element.Summary "date" ($element.Date.Format ($.Param "dateformat" | default "2 January, 2006"))) -}} {{- end -}} {{- $.Scratch.Get "searchindex" | jsonify -}} diff --git a/layouts/index.html b/layouts/index.html index 82c4e3f..92241b7 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,4 +1,4 @@ -{{ define "title" }}{{ .Site.Title }}{{ end }} +{{ define "title" }}{{ site.Title }}{{ end }} {{ define "main" -}}
@@ -8,7 +8,7 @@
-{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} +{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ $paginator := .Paginate $pages -}} {{ range $paginator.Pages -}} {{ .Render "summary"}} diff --git a/layouts/micro/list.json.json b/layouts/micro/list.json.json index 5046229..778a5d3 100644 --- a/layouts/micro/list.json.json +++ b/layouts/micro/list.json.json @@ -2,9 +2,9 @@ {{ $length := (len $list) -}} { "version" : "https://jsonfeed.org/version/1", - "title" : "Micro posts {{ i18n "string_on" }} {{ .Site.Title }}", - "description": "Micro blog {{ i18n "string_by" }} {{ with $.Site.Author.name }}{{ . }}{{end}}, {{ i18n "string_follow" }} @{{ with $.Param "microusername" }}{{ . }}{{ end }} {{ i18n "string_at" }} https://micro.blog/{{ with $.Param "microusername" }}{{ . }}{{ end }}", - "home_page_url" : "{{ .Site.BaseURL }}", + "title" : "Micro posts {{ i18n "string_on" }} {{ site.Title }}", + "description": "Micro blog {{ i18n "string_by" }} {{ with site.Author.name }}{{ . }}{{end}}, {{ i18n "string_follow" }} @{{ with $.Param "microusername" }}{{ . }}{{ end }} {{ i18n "string_at" }} https://micro.blog/{{ with $.Param "microusername" }}{{ . }}{{ end }}", + "home_page_url" : "{{ site.BaseURL }}", {{ with .OutputFormats.Get "JSON" -}} "feed_url" : "{{ .Permalink }}", {{ end -}} @@ -14,10 +14,10 @@ {{ with $.Param "favicon" -}} "favicon" : "{{ . | absURL }}", {{ end -}} - {{ with .Site.Author.name -}} + {{ with site.Author.name -}} "author" : { - "name" : "{{ . }}"{{ with $.Site.Author.url }}, - "url": "{{ . }}"{{ end }}{{ with $.Site.Author.avatar }}, + "name" : "{{ . }}"{{ with site.Author.url }}, + "url": "{{ . }}"{{ end }}{{ with site.Author.avatar }}, "avatar": "{{ . | absURL }}"{{ end }} }, {{ end -}} diff --git a/layouts/micro/rss.xml b/layouts/micro/rss.xml index 681e8d1..18473c7 100644 --- a/layouts/micro/rss.xml +++ b/layouts/micro/rss.xml @@ -1,19 +1,19 @@ - Micro posts {{ i18n "string_on" }} {{ .Site.Title }} + Micro posts {{ i18n "string_on" }} {{ site.Title }} {{ .Permalink }} - Micro blog {{ i18n "string_by" }} {{ with $.Site.Author.name }}{{ . }}{{end}}, {{ i18n "string_follow" }} @{{ with $.Param "microusername" }}{{ . }}{{ end }} {{ i18n "string_at" }} https://micro.blog/{{ with $.Param "microusername" }}{{ . }}{{ end }} + Micro blog {{ i18n "string_by" }} {{ with site.Author.name }}{{ . }}{{end}}, {{ i18n "string_follow" }} @{{ with $.Param "microusername" }}{{ . }}{{ end }} {{ i18n "string_at" }} https://micro.blog/{{ with $.Param "microusername" }}{{ . }}{{ end }} Hugo -- gohugo.io - {{ with .Site.LanguageCode -}} + {{ with site.LanguageCode -}} {{ . }} {{ end -}} - {{ with .Site.Author.email -}} - {{ . }}{{ with $.Site.Author.name }} ({{ . }}){{end}} + {{ with site.Author.email -}} + {{ . }}{{ with site.Author.name }} ({{ . }}){{end}} {{ end -}} - {{ with .Site.Author.email -}} - {{ . }}{{ with $.Site.Author.name }} ({{ . }}){{end}} + {{ with site.Author.email -}} + {{ . }}{{ with site.Author.name }} ({{ . }}){{end}} {{ end -}} - {{ with .Site.Copyright -}} + {{ with site.Copyright -}} {{ . }} {{ end -}} {{ if not .Date.IsZero -}} diff --git a/layouts/partials/cookieconsent.html b/layouts/partials/cookieconsent.html index 2fe648a..5a05816 100644 --- a/layouts/partials/cookieconsent.html +++ b/layouts/partials/cookieconsent.html @@ -1,7 +1,7 @@