summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAditya Telange <21258296+adityatelange@users.noreply.github.com>2022-03-27 18:44:06 +0530
committerAditya Telange <21258296+adityatelange@users.noreply.github.com>2022-03-27 18:44:06 +0530
commit575cc0ca8c4e5904c7ae77e76db812c52e5f8ed1 (patch)
tree29b83f765f6ccae88651886167681b4afdb71069 /layouts
parent975972e04181007c61302054d18735dc440a0586 (diff)
Use `site` function instead of `.Site` or `$.Site`
- The site function provides global access to the same data as the .Site page method. - Current context (`.`) is never considered.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/archives.html2
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/index.json2
-rw-r--r--layouts/_default/list.html8
-rw-r--r--layouts/_default/rss.xml22
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/_default/terms.html2
-rw-r--r--layouts/partials/author.html4
-rw-r--r--layouts/partials/breadcrumbs.html4
-rw-r--r--layouts/partials/cover.html6
-rw-r--r--layouts/partials/edit_post.html8
-rw-r--r--layouts/partials/footer.html12
-rw-r--r--layouts/partials/head.html56
-rw-r--r--layouts/partials/header.html30
-rw-r--r--layouts/partials/home_info.html4
-rw-r--r--layouts/partials/index_profile.html6
-rw-r--r--layouts/partials/post_canonical.html4
-rw-r--r--layouts/partials/post_meta.html2
-rw-r--r--layouts/partials/templates/opengraph.html10
-rw-r--r--layouts/partials/templates/schema_json.html28
-rw-r--r--layouts/partials/templates/twitter_cards.html6
-rw-r--r--layouts/partials/translation_list.html4
-rw-r--r--layouts/robots.txt2
23 files changed, 115 insertions, 115 deletions
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 435d2a1..e400e2c 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -11,7 +11,7 @@
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
-{{- if .Site.Params.ShowAllPagesInArchive }}
+{{- if site.Params.ShowAllPagesInArchive }}
{{- $pages = site.RegularPages }}
{{- end }}
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 6dfe741..3d13f07 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}">
+<html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}">
<head>
{{- partial "head.html" . }}
@@ -9,7 +9,7 @@
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
{{- print "list" -}}
{{- end -}}
-{{- if eq $.Site.Params.defaultTheme `dark` -}}
+{{- if eq site.Params.defaultTheme `dark` -}}
{{- print " dark" }}
{{- end -}}
" id="top">
diff --git a/layouts/_default/index.json b/layouts/_default/index.json
index 2c86f7c..feeb437 100644
--- a/layouts/_default/index.json
+++ b/layouts/_default/index.json
@@ -1,5 +1,5 @@
{{- $.Scratch.Add "index" slice -}}
-{{- range .Site.RegularPages -}}
+{{- range site.RegularPages -}}
{{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }}
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 0cc1ad9..f4ff6ec 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,6 +1,6 @@
{{- define "main" }}
-{{- if (and .Site.Params.profileMode.enabled .IsHome) }}
+{{- if (and site.Params.profileMode.enabled .IsHome) }}
{{- partial "index_profile.html" . }}
{{- else }} {{/* if not profileMode */}}
@@ -32,7 +32,7 @@
{{- $paginator := .Paginate $pages }}
-{{- if and .IsHome .Site.Params.homeInfoParams (eq $paginator.PageNumber 1) }}
+{{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }}
{{- partial "home_info.html" . }}
{{- end }}
@@ -41,7 +41,7 @@
{{- $class := "post-entry" }}
-{{- $user_preferred := or .Site.Params.disableSpecial1stPost .Site.Params.homeInfoParams }}
+{{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }}
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }}
{{- $class = "first-entry" }}
{{- else if $term }}
@@ -49,7 +49,7 @@
{{- end }}
<article class="{{ $class }}">
- {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }}
+ {{- $isHidden := (site.Params.cover.hidden | default site.Params.cover.hiddenInList) }}
{{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }}
<header class="entry-header">
<h2>
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index eca41b7..134d50d 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,31 +1,31 @@
{{- $pctx := . -}}
-{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
-{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
- <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
+ <title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
- <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
- {{- with $.Site.Params.images }}
+ <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description>
+ {{- with site.Params.images }}
<image>
<url>{{ index . 0 | absURL }}</url>
<link>{{ index . 0 | absURL }}</link>
</image>
{{- end }}
- <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
- <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
- <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
- <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
+ <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
+ <language>{{.}}</language>{{end}}{{ with site.Author.email }}
+ <managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }}
+ <webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
@@ -37,10 +37,10 @@
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
- {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
+ {{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
- {{- if .Site.Params.ShowFullTextinRSS }}
+ {{- if site.Params.ShowFullTextinRSS }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- end }}
</item>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 1d983fd..d313500 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -21,7 +21,7 @@
</div>
{{- end }}
</header>
- {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden }}
+ {{- $isHidden := .Params.cover.hidden | default site.Params.cover.hiddenInSingle | default site.Params.cover.hidden }}
{{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }}
{{- if (.Param "ShowToc") }}
{{- partial "toc.html" . }}
@@ -46,7 +46,7 @@
{{- if (.Param "ShowPostNavLinks") }}
{{- partial "post_nav_links.html" . }}
{{- end }}
- {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
+ {{- if (and site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
{{- partial "share_icons.html" . -}}
{{- end }}
</footer>
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index d5a9e66..6fd2654 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -16,7 +16,7 @@
{{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }}
{{- $count := .Count }}
- {{- with $.Site.GetPage (printf "/%s/%s" $type $name) }}
+ {{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
index 4582b12..8f2758f 100644
--- a/layouts/partials/author.html
+++ b/layouts/partials/author.html
@@ -1,5 +1,5 @@
-{{- if or .Params.author .Site.Params.author }}
-{{- $author := (.Params.author | default .Site.Params.author) }}
+{{- if or .Params.author site.Params.author }}
+{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }}
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html
index 742254a..7e8257b 100644
--- a/layouts/partials/breadcrumbs.html
+++ b/layouts/partials/breadcrumbs.html
@@ -1,6 +1,6 @@
{{- if (.Param "ShowBreadCrumbs") -}}
<div class="breadcrumbs">
- {{- $url := replace .Parent.Permalink (printf "%s" .Site.BaseURL) "" }}
+ {{- $url := replace .Parent.Permalink (printf "%s" site.BaseURL) "" }}
{{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a>
@@ -8,7 +8,7 @@
{{- range $index, $element := split $lang_url "/" }}
{{- $scratch.Add "path" (printf "%s/" $element )}}
- {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}}
+ {{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- print "&nbsp;ยป&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>
diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html
index b4e7c78..5c5f2fb 100644
--- a/layouts/partials/cover.html
+++ b/layouts/partials/cover.html
@@ -2,8 +2,8 @@
{{- if (and .Params.cover.image (not $.isHidden)) }}
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
<figure class="entry-cover">
- {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }}
- {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }}
+ {{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
+ {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }}
{{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
{{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank"
@@ -13,7 +13,7 @@
{{- if hugo.IsExtended -}}
{{- $processableFormats = $processableFormats | append "webp" -}}
{{- end -}}
- {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }}
+ {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
{{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }}
<img loading="lazy" srcset="{{- range $size := $sizes -}}
{{- if (ge $cover.Width $size) -}}
diff --git a/layouts/partials/edit_post.html b/layouts/partials/edit_post.html
index 1d90ebd..efa4c70 100644
--- a/layouts/partials/edit_post.html
+++ b/layouts/partials/edit_post.html
@@ -1,8 +1,8 @@
-{{- if or .Params.editPost.URL .Site.Params.editPost.URL -}}
+{{- if or .Params.editPost.URL site.Params.editPost.URL -}}
{{- $fileUrlPath := path.Join .File.Path }}
-{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}}
-<a href="{{ .Params.editPost.URL | default .Site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( .Site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer" target="_blank">
- {{- .Params.editPost.Text | default (.Site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
+{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}}
+<a href="{{ .Params.editPost.URL | default site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer" target="_blank">
+ {{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
</a>
{{- end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 8dee328..d76058f 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,9 +1,9 @@
{{- if not (.Param "hideFooter") }}
<footer class="footer">
- {{- if .Site.Copyright }}
- <span>{{ .Site.Copyright | markdownify }}</span>
+ {{- if site.Copyright }}
+ <span>{{ site.Copyright | markdownify }}</span>
{{- else }}
- <span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span>
+ <span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ site.Title }}</a></span>
{{- end }}
<span>
Powered by
@@ -13,7 +13,7 @@
</footer>
{{- end }}
-{{- if (not .Site.Params.disableScrollToTop) }}
+{{- if (not site.Params.disableScrollToTop) }}
<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
<path d="M12 6H0l6-6z" />
@@ -53,7 +53,7 @@
</script>
-{{- if (not .Site.Params.disableScrollToTop) }}
+{{- if (not site.Params.disableScrollToTop) }}
<script>
var mybutton = document.getElementById("top-link");
window.onscroll = function () {
@@ -69,7 +69,7 @@
</script>
{{- end }}
-{{- if (not .Site.Params.disableThemeToggle) }}
+{{- if (not site.Params.disableThemeToggle) }}
<script>
document.getElementById("theme-toggle").addEventListener("click", () => {
if (document.body.className.includes("dark")) {
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 0d3fa72..ed70b31 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,36 +1,36 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }}
+{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
<meta name="robots" content="index, follow">
{{- else }}
<meta name="robots" content="noindex, nofollow">
{{- end }}
{{- /* Title */}}
-<title>{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ .Site.Title }}</title>
+<title>{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ site.Title }}</title>
{{- /* Meta */}}
{{- if .IsHome }}
-{{ with .Site.Params.keywords -}}<meta name="keywords" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" />{{ end }}
+{{ with site.Params.keywords -}}<meta name="keywords" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" />{{ end }}
{{- else }}
<meta name="keywords" content="{{ if .Params.keywords -}}
{{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }}
{{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}" />
{{- end }}
<meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if or .IsPage .IsSection}}
- {{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }}
- {{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
+ {{- .Summary | default (printf "%s - %s" .Title site.Title) }}{{- else }}
+ {{- with site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
<meta name="author" content="{{ (partial "author.html" . ) }}">
<link rel="canonical" href="{{ if .Params.canonicalURL -}} {{ trim .Params.canonicalURL " " }} {{- else -}} {{ .Permalink }} {{- end }}" />
-{{- if .Site.Params.analytics.google.SiteVerificationTag }}
-<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" />
+{{- if site.Params.analytics.googlesiteVerificationTag }}
+<meta name="google-site-verification" content="{{ site.Params.analytics.googlesiteVerificationTag }}" />
{{- end }}
-{{- if .Site.Params.analytics.yandex.SiteVerificationTag }}
-<meta name="yandex-verification" content="{{ .Site.Params.analytics.yandex.SiteVerificationTag }}" />
+{{- if site.Params.analytics.yandexsiteVerificationTag }}
+<meta name="yandex-verification" content="{{ site.Params.analytics.yandexsiteVerificationTag }}" />
{{- end }}
-{{- if .Site.Params.analytics.bing.SiteVerificationTag }}
-<meta name="msvalidate.01" content="{{ .Site.Params.analytics.bing.SiteVerificationTag }}" />
+{{- if site.Params.analytics.bingsiteVerificationTag }}
+<meta name="msvalidate.01" content="{{ site.Params.analytics.bingsiteVerificationTag }}" />
{{- end }}
{{- /* Styles */}}
@@ -40,7 +40,7 @@
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
{{- /* include `an-old-hope` if hljs is on */}}
-{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default false) }}
+{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default false) }}
{{- $hljs := (cond ($isHLJSdisabled) (" " | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }}
{{- /* order is important */}}
@@ -51,29 +51,29 @@
{{- /* Add extended css after theme style */ -}}
{{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }}
-{{- if not .Site.Params.assets.disableFingerprinting }}
+{{- if not site.Params.assets.disableFingerprinting }}
{{- $stylesheet := $stylesheet | fingerprint }}
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style">
{{- else }}
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
{{- end }}
-{{- with .Site.Params.profileMode }}
+{{- with site.Params.profileMode }}
{{- if and .enabled .imageUrl $.IsHome }}
<link rel="preload" href="{{ .imageUrl }}" as="image">
{{- end }}
{{- end }}
-{{- with .Site.Params.label.icon }}
+{{- with site.Params.label.icon }}
<link rel="preload" href="{{ . }}" as="image">
{{- end }}
{{- /* Search */}}
{{- if (eq .Layout `search`) -}}
<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json">
-{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" .Site.Params.fuseOpts)) }}
+{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) }}
{{- $fusejs := resources.Get "js/fuse.basic.min.js" }}
-{{- if not .Site.Params.assets.disableFingerprinting }}
+{{- if not site.Params.assets.disableFingerprinting }}
{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
{{- else }}
@@ -83,9 +83,9 @@
{{- end -}}
{{- /* Highlight.js */}}
-{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }}
+{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default .Params.disableHLJS ) }}
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }}
-{{- if not .Site.Params.assets.disableFingerprinting }}
+{{- if not site.Params.assets.disableFingerprinting }}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}"
onload="hljs.initHighlightingOnLoad();"></script>
@@ -96,13 +96,13 @@
{{- end }}
{{- /* Favicons */}}
-<link rel="icon" href="{{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}">
-<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">
-<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.assets.favicon32x32 | default "favicon-32x32.png" | absURL }}">
-<link rel="apple-touch-icon" href="{{ .Site.Params.assets.apple_touch_icon | default "apple-touch-icon.png" | absURL }}">
-<link rel="mask-icon" href="{{ .Site.Params.assets.safari_pinned_tab | default "safari-pinned-tab.svg" | absURL }}">
-<meta name="theme-color" content="{{ .Site.Params.assets.theme_color | default "#2e2e33" }}">
-<meta name="msapplication-TileColor" content="{{ .Site.Params.assets.msapplication_TileColor | default "#2e2e33" }}">
+<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
+<link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">
+<link rel="icon" type="image/png" sizes="32x32" href="{{ site.Params.assets.favicon32x32 | default "favicon-32x32.png" | absURL }}">
+<link rel="apple-touch-icon" href="{{ site.Params.assets.apple_touch_icon | default "apple-touch-icon.png" | absURL }}">
+<link rel="mask-icon" href="{{ site.Params.assets.safari_pinned_tab | default "safari-pinned-tab.svg" | absURL }}">
+<meta name="theme-color" content="{{ site.Params.assets.theme_color | default "#2e2e33" }}">
+<meta name="msapplication-TileColor" content="{{ site.Params.assets.msapplication_TileColor | default "#2e2e33" }}">
{{- /* RSS */}}
{{ range .AlternativeOutputFormats -}}
@@ -120,7 +120,7 @@
}
</style>
- {{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }}
+ {{- if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark")) }}
<style>
@media (prefers-color-scheme: dark) {
:root {
@@ -155,7 +155,7 @@
{{- partial "extend_head.html" . -}}
{{- /* Misc */}}
-{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }}
+{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
{{- template "_internal/google_analytics.html" . }}
{{- template "partials/templates/opengraph.html" . }}
{{- template "partials/templates/twitter_cards.html" . }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index f95a7a6..ff674c5 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,7 +1,7 @@
{{- /* theme-toggle is enabled */}}
-{{- if (not .Site.Params.disableThemeToggle) }}
+{{- if (not site.Params.disableThemeToggle) }}
{{- /* theme is light */}}
-{{- if (eq .Site.Params.defaultTheme "light") }}
+{{- if (eq site.Params.defaultTheme "light") }}
<script>
if (localStorage.getItem("pref-theme") === "dark") {
document.body.classList.add('dark');
@@ -9,7 +9,7 @@
</script>
{{- /* theme is dark */}}
-{{- else if (eq .Site.Params.defaultTheme "dark") }}
+{{- else if (eq site.Params.defaultTheme "dark") }}
<script>
if (localStorage.getItem("pref-theme") === "light") {
document.body.classList.remove('dark')
@@ -30,7 +30,7 @@
</script>
{{- end }}
{{- /* theme-toggle is disabled and theme is auto */}}
-{{- else if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark"))}}
+{{- else if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark"))}}
<script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
@@ -42,18 +42,18 @@
<header class="header">
<nav class="nav">
<div class="logo">
- {{- $label_text := (.Site.Params.label.text | default .Site.Title) }}
- {{- if .Site.Title }}
+ {{- $label_text := (site.Params.label.text | default site.Title) }}
+ {{- if site.Title }}
<a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)">
- {{- if .Site.Params.label.icon }}
- <img src="{{- .Site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo"
- height="{{- .Site.Params.label.iconHeight | default "30" -}}">
+ {{- if site.Params.label.icon }}
+ <img src="{{- site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo"
+ height="{{- site.Params.label.iconHeight | default "30" -}}">
{{- end -}}
{{- $label_text -}}
</a>
{{- end }}
<span class="logo-switches">
- {{- if (not .Site.Params.disableThemeToggle) }}
+ {{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" accesskey="t" title="(Alt + T)">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
@@ -77,8 +77,8 @@
{{- end }}
{{- $lang := .Lang}}
- {{- $separator := or $label_text (not .Site.Params.disableThemeToggle)}}
- {{- with $.Site.Home.AllTranslations }}
+ {{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
+ {{- with site.Home.AllTranslations }}
<ul class="lang-switch">
{{- if $separator }}<li>|</li>{{ end }}
{{- range . -}}
@@ -86,7 +86,7 @@
<li>
<a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}"
aria-label="{{ .Language.LanguageName | default (.Lang | title) }}">
- {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
+ {{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}}
{{- else }}
{{- .Lang | title -}}
@@ -101,10 +101,10 @@
</div>
{{- $currentPage := . }}
<ul id="menu">
- {{- range .Site.Menus.main }}
+ {{- range site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
{{- $page_url:= $currentPage.Permalink | absLangURL }}
- {{- $is_search := eq ($.Site.GetPage .KeyName).Layout `search` }}
+ {{- $is_search := eq (site.GetPage .KeyName).Layout `search` }}
<li>
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
diff --git a/layouts/partials/home_info.html b/layouts/partials/home_info.html
index 4db55d7..eb55364 100644
--- a/layouts/partials/home_info.html
+++ b/layouts/partials/home_info.html
@@ -1,4 +1,4 @@
-{{- with $.Site.Params.homeInfoParams }}
+{{- with site.Params.homeInfoParams }}
<article class="first-entry home-info">
<header class="entry-header">
<h1>{{ .Title | markdownify }}</h1>
@@ -7,7 +7,7 @@
<p>{{ .Content | markdownify }}</p>
</section>
<footer class="entry-footer">
- {{ partial "social_icons.html" $.Site.Params.socialIcons }}
+ {{ partial "social_icons.html" site.Params.socialIcons }}
</footer>
</article>
{{- end -}}
diff --git a/layouts/partials/index_profile.html b/layouts/partials/index_profile.html
index 4e961ba..3851e71 100644
--- a/layouts/partials/index_profile.html
+++ b/layouts/partials/index_profile.html
@@ -1,13 +1,13 @@
<div class="profile">
- {{- with .Site.Params.profileMode }}
+ {{- with site.Params.profileMode }}
<div class="profile_inner">
{{- if .imageUrl -}}
<img src="{{ .imageUrl | absURL }}" alt="{{ .imageTitle | default "profile image" }}"
height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" />
{{- end }}
- <h1>{{ .title | default $.Site.Title | markdownify }}</h1>
+ <h1>{{ .title | default site.Title | markdownify }}</h1>
<span>{{ .subtitle | markdownify }}</span>
- {{- partial "social_icons.html" $.Site.Params.socialIcons -}}
+ {{- partial "social_icons.html" site.Params.socialIcons -}}
{{- with .buttons }}
<div class="buttons">
diff --git a/layouts/partials/post_canonical.html b/layouts/partials/post_canonical.html
index 9befad1..abfc1e3 100644
--- a/layouts/partials/post_canonical.html
+++ b/layouts/partials/post_canonical.html
@@ -1,9 +1,9 @@
{{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}}
{{ $url := urls.Parse .Params.canonicalURL }}
-{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL .Site.Params.editPost.URL) }}&nbsp;|&nbsp;{{- end -}}
+{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL site.Params.editPost.URL) }}&nbsp;|&nbsp;{{- end -}}
<span>
- {{- (.Site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}}
+ {{- (site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}}
&nbsp;<a href="{{ trim .Params.canonicalURL " " }}" title="{{ trim .Params.canonicalURL " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a>
</span>
{{- end }}
diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html
index f7134fb..15b8b1b 100644
--- a/layouts/partials/post_meta.html
+++ b/layouts/partials/post_meta.html
@@ -1,7 +1,7 @@
{{- $scratch := newScratch }}
{{- if not .Date.IsZero -}}
-{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" .Site.Params.DateFormat)))) }}
+{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }}
{{- end }}
{{- if (.Param "ShowReadingTime") -}}
diff --git a/layouts/partials/templates/opengraph.html b/layouts/partials/templates/opengraph.html
index 9bbd90b..13e7b2b 100644
--- a/layouts/partials/templates/opengraph.html
+++ b/layouts/partials/templates/opengraph.html
@@ -1,5 +1,5 @@
<meta property="og:title" content="{{ .Title }}" />
-<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
+<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{- if .Params.cover.image -}}
@@ -19,7 +19,7 @@
{{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
-{{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
+{{- with site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
{{- end -}}
{{- end -}}
{{- end }}
@@ -33,14 +33,14 @@
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
-{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
+{{- with site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
{{- with .Params.videos }}{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" />
{{ end }}{{ end }}
{{- /* If it is part of a series, link to related articles */}}
{{- $permalink := .Permalink }}
-{{- $siteSeries := .Site.Taxonomies.series }}
+{{- $siteSeries := site.Taxonomies.series }}
{{ with .Params.series }}{{- range $name := . }}
{{- $series := index $siteSeries ($name | urlize) }}
{{- range $page := first 6 $series.Pages }}
@@ -49,4 +49,4 @@
{{ end }}{{ end }}
{{- /* Facebook Page Admin ID for Domain Insights */}}
-{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
+{{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html
index 5cf3857..74abbb5 100644
--- a/layouts/partials/templates/schema_json.html
+++ b/layouts/partials/templates/schema_json.html
@@ -2,23 +2,23 @@
<script type="application/ld+json">
{
"@context": "https://schema.org",
- "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}",
- "name": {{ .Site.Title }},
- "url": {{ .Site.BaseURL }},
- "description": {{ .Site.Params.description | plainify | truncate 180 | safeHTML }},
- "thumbnailUrl": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }},
+ "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
+ "name": {{ site.Title }},
+ "url": {{ site.BaseURL }},
+ "description": {{ site.Params.description | plainify | truncate 180 | safeHTML }},
+ "thumbnailUrl": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }},
"sameAs": [
- {{- if .Site.Params.schema.sameAs }}
- {{ range $i, $e := .Site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }}
+ {{- if site.Params.schema.sameAs }}
+ {{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }}
{{- else}}
- {{ range $i, $e := .Site.Params.SocialIcons }}{{ if $i }}, {{ end }}{{ trim $e.url " " }}{{ end }}
+ {{ range $i, $e := site.Params.SocialIcons }}{{ if $i }}, {{ end }}{{ trim $e.url " " }}{{ end }}
{{- end}}
]
}
</script>
{{- else if (or .IsPage .IsSection) }}
{{/* BreadcrumbList */}}
-{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
+{{- $url := replace .Parent.Permalink ( printf "%s" site.BaseURL) "" }}
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
{{- $bc_list := (split $lang_url "/")}}
@@ -31,7 +31,7 @@
{{- range $index, $element := $bc_list }}
{{- $scratch.Add "path" (printf "%s/" $element ) | safeJS }}
- {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}}
+ {{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- if (and $index)}}, {{end }}
@@ -83,7 +83,7 @@
{{- end -}}
"datePublished": {{ .PublishDate }},
"dateModified": {{ .Lastmod }},
- {{- with (.Params.author | default .Site.Params.author) }}
+ {{- with (.Params.author | default site.Params.author) }}
"author":
{{- if (or (eq (printf "%T" .) "[]string") (eq (printf "%T" .) "[]interface {}")) -}}
[{{- range $i, $v := . -}}
@@ -105,11 +105,11 @@
"@id": {{ .Permalink | safeHTML }}
},
"publisher": {
- "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}",
- "name": {{ .Site.Title }},
+ "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
+ "name": {{ site.Title }},
"logo": {
"@type": "ImageObject",
- "url": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}
+ "url": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }}
}
}
}
diff --git a/layouts/partials/templates/twitter_cards.html b/layouts/partials/templates/twitter_cards.html
index 02270de..bd46e37 100644
--- a/layouts/partials/templates/twitter_cards.html
+++ b/layouts/partials/templates/twitter_cards.html
@@ -17,7 +17,7 @@
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
-{{- with $.Site.Params.images -}}
+{{- with site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
@@ -27,7 +27,7 @@
{{- end }}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
-<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
-{{ with .Site.Social.twitter -}}
+<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
+{{ with site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
diff --git a/layouts/partials/translation_list.html b/layouts/partials/translation_list.html
index e1c34e1..9d28e15 100644
--- a/layouts/partials/translation_list.html
+++ b/layouts/partials/translation_list.html
@@ -1,13 +1,13 @@
{{- if .IsTranslated -}}
{{- if (ne .Layout "search") }}
-{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
+{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}}
{{- end }}
<ul class="i18n_list">
{{- i18n "translations" | default "Translations" }}:
{{- range .Translations }}
<li>
<a href="{{ .Permalink }}">
- {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
+ {{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}}
{{- else }}
{{- .Lang | title -}}
diff --git a/layouts/robots.txt b/layouts/robots.txt
index da3e7e0..f26f508 100644
--- a/layouts/robots.txt
+++ b/layouts/robots.txt
@@ -1,5 +1,5 @@
User-agent: *
-{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }}
+{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
Disallow:
{{- else }}
Disallow: /