Replace .Site.x and $.Site.x with site.x.

This commit is contained in:
Fredrik Jonsson 2021-12-21 18:52:39 +01:00
commit 3737d5874c
10 changed files with 99 additions and 98 deletions

View file

@ -1,7 +1,7 @@
<div class="cookieconsent layout__cookieconsent hidden">
<div class="cookieconsent__message">
{{ i18n "cookieconsent_message" }}
{{ with .Site.Params.privacyPolicyUrl }}<a href="{{ . }}">{{ i18n "privacy_policy" }}</a>{{ end }}
{{ with site.Params.privacyPolicyUrl }}<a href="{{ . }}">{{ i18n "privacy_policy" }}</a>{{ end }}
</div>
<div class="cookieconsent__actions">
<button class="button button--small button--cookieconsent button--decline" type="button" data-consent="false">{{ i18n "cookieconsent_decline" }}</button>

View file

@ -10,8 +10,8 @@
<li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Language.Params.LanguageCode | default .Lang }}" lang="{{ .Language.Params.LanguageCode | default .Lang }}">{{ .Language.LanguageName }}</a></li>
{{ end -}}
{{ else -}}
{{ range .Site.Languages -}}
{{ if ne $.Site.Language.Lang .Lang }}
{{ range site.Languages -}}
{{ if ne site.Language.Lang .Lang }}
<li><a rel="alternate" href="{{ .Lang | relURL }}" hreflang="{{ .Params.LanguageCode | default .Lang }}" lang="{{ .Params.LanguageCode | default .Lang }}">{{ .LanguageName }}</a></li>
{{ end -}}
{{ end -}}

View file

@ -1,10 +1,10 @@
<nav class="main-menu layout__navigation">
<h2 class="visually-hidden">{{ i18n "menu_title" }}</h2>
<ul class="navbar">
{{ if .Site.Menus.main -}}
{{ if site.Menus.main -}}
{{ $currentPage := . -}}
{{ range .Site.Menus.main -}}
{{ range site.Menus.main -}}
<li><a href="{{ .URL | relLangURL }}"{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} class="active" aria-current="page"{{ end }}>{{ .Name }}</a></li>
{{ end -}}
@ -13,11 +13,11 @@
{{ $currentSection := .Section -}}
{{ $currentID := "" -}}
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
{{ with .Site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where .Site.RegularPages "Section" "" -}}
{{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where site.RegularPages "Section" "" -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ .Title }}</a></li>
{{ end -}}
{{ range .Site.Sections -}}
{{ range site.Sections -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} class="active" aria-current="page"{{ end }}>{{ .Title }}</a></li>
{{ end -}}

View file

@ -6,7 +6,7 @@
<meta name="modified" {{ printf "content=%q" (.Lastmod.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}
{{ with $.Param "contact" }}<meta name="contact" content="{{ . }}">{{ end }}
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:site_name" content="{{ site.Title }}">
<meta property="og:title" content="{{ .Title }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
@ -14,7 +14,7 @@
{{ hugo.Generator }}
<meta name="msapplication-TileColor" content="{{ $.Param "themecolor" | default "#ffffff" }}">
<meta name="theme-color" content="{{ $.Param "themecolor" | default "#ffffff" }}">
{{ with .Site.Params.piwikTrackerUrl }}<link rel="dns-prefetch" href="https://{{ . }}">{{ end }}
{{ with site.Params.piwikTrackerUrl }}<link rel="dns-prefetch" href="https://{{ . }}">{{ end }}
{{ with $.Param "microusername" }}<link rel="me" href="https://micro.blog/{{ . }}">{{ end }}
<link rel="canonical" href="{{ .Permalink }}">
{{ if .IsTranslated -}}

View file

@ -30,18 +30,18 @@
{{ end -}}
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ .Site.BaseURL }}
"@id": {{ site.BaseURL }}
},
"publisher": {
"@type": "Organization",
"name": {{ .Site.Title }},
"name": {{ site.Title }},
{{ with $.Param "icon" -}}
"logo" : {
"@type": "ImageObject",
"url": {{ . | absURL }}
},
{{ end -}}
"url": {{ .Site.BaseURL }}
"url": {{ site.BaseURL }}
}
}
</script>

View file

@ -3,15 +3,15 @@
<a href="#navigation" class="mobile-nav__toggle" aria-haspopup="true" role="button">{{ i18n "menu_mobile" }}</a>
<div class="mobile-nav__sheet">
<div class="mobile-nav__region">
{{ if .Site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end }}
{{ if site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end }}
</div>
<nav class="mobile-nav__main-menu">
<h2 class="visually-hidden">{{ i18n "menu_title" }}</h2>
<ul class="mobile-nav__navbar">
{{ if .Site.Menus.main -}}
{{ if site.Menus.main -}}
{{ $currentPage := . -}}
{{ range .Site.Menus.main -}}
{{ range site.Menus.main -}}
<li><a href="{{ .URL | relLangURL }}"{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} class="active" aria-current="page"{{ end }}>{{ .Name }}</a></li>
{{ end -}}
@ -20,11 +20,11 @@
{{ $currentSection := .Section -}}
{{ $currentID := "" -}}
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
{{ with .Site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where .Site.RegularPages "Section" "" -}}
{{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where site.RegularPages "Section" "" -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} class="active" aria-current="page"{{ end }}>{{ .Title }}</a></li>
{{ end -}}
{{ range .Site.Sections -}}
{{ range site.Sections -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} class="active" aria-current="page"{{ end }}>{{ .Title }}</a></li>
{{ end -}}

View file

@ -1,9 +1,9 @@
{{ $src := (.Params.podcast.mp3 | absURL) -}}
{{ if .Site.Params.Podcast.cdn -}}
{{ $src = add $.Site.Params.Podcast.cdn (.Params.podcast.mp3 | relURL) -}}
{{ if site.Params.Podcast.cdn -}}
{{ $src = add site.Params.Podcast.cdn (.Params.podcast.mp3 | relURL) -}}
{{ end -}}
<figure class="podcast">
<audio controls preload="{{ .Site.Params.Podcast.preload | default "metadata" }}"><source src="{{ $src }}" type="audio/mpeg"></audio>
<audio controls preload="{{ site.Params.Podcast.preload | default "metadata" }}"><source src="{{ $src }}" type="audio/mpeg"></audio>
<figcaption><a href="{{ $src }}">{{ .Title }}</a></figcaption>
</figure>
{{ with .Params.podcast.image }}

View file

@ -1,5 +1,5 @@
<aside class="related layout__related">
{{ $related := .Site.RegularPages.Related . | first 3 -}}
{{ $related := site.RegularPages.Related . | first 3 -}}
{{ with $related -}}
<h2>{{ i18n "string_see_also" }}</h2>
<ul>

View file

@ -2,7 +2,7 @@
{{ $currentID := "" -}}
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
<aside class="sidebar layout__second-sidebar">
{{ range .Site.Sections -}}
{{ range site.Sections -}}
<section>
<h4 class="menu"><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} class="active" aria-current="page"{{ end }}>{{ .Title }}</a></h4>
<ul class="menu">

View file

@ -1,14 +1,14 @@
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID -}}
{{ if and site.Params.piwikTrackerUrl site.Params.piwikSiteID -}}
{{ $script := resources.Get "js/tracking.js" | resources.ExecuteAsTemplate "js/tracking.js" . | minify | fingerprint -}}
<script src="{{ $script.RelPermalink }}"></script>
<script defer src="https://{{ .Site.Params.piwikTrackerUrl }}/matomo.js"></script>
<script defer src="https://{{ site.Params.piwikTrackerUrl }}/matomo.js"></script>
{{ end -}}
{{ if .Site.Params.plausibleSiteID -}}
<script async defer data-domain="{{ .Site.Params.plausibleSiteID }}" src="{{ .Site.Params.plausibleTrackerURL | default "https://plausible.io/js/plausible.js" }}"></script>
{{ if site.Params.plausibleSiteID -}}
<script async defer data-domain="{{ site.Params.plausibleSiteID }}" src="{{ site.Params.plausibleTrackerURL | default "https://plausible.io/js/plausible.js" }}"></script>
{{ end -}}
{{ if .Site.GoogleAnalytics -}}
{{ if site.GoogleAnalytics -}}
{{ $script := resources.Get "js/tracking.js" | resources.ExecuteAsTemplate "js/tracking.js" . | minify | fingerprint -}}
<script src="{{ $script.RelPermalink }}"></script>
{{ template "_internal/google_analytics.html" . }}