From 575cc0ca8c4e5904c7ae77e76db812c52e5f8ed1 Mon Sep 17 00:00:00 2001
From: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Date: Sun, 27 Mar 2022 18:44:06 +0530
Subject: 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.
---
layouts/partials/head.html | 56 +++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 28 deletions(-)
(limited to 'layouts/partials/head.html')
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 @@
-{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }}
+{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
{{- else }}
{{- end }}
{{- /* Title */}}
-
{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ .Site.Title }}
+{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ site.Title }}
{{- /* Meta */}}
{{- if .IsHome }}
-{{ with .Site.Params.keywords -}}{{ end }}
+{{ with site.Params.keywords -}}{{ end }}
{{- else }}
{{- end }}
+ {{- .Summary | default (printf "%s - %s" .Title site.Title) }}{{- else }}
+ {{- with site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
-{{- if .Site.Params.analytics.google.SiteVerificationTag }}
-
+{{- if site.Params.analytics.googlesiteVerificationTag }}
+
{{- end }}
-{{- if .Site.Params.analytics.yandex.SiteVerificationTag }}
-
+{{- if site.Params.analytics.yandexsiteVerificationTag }}
+
{{- end }}
-{{- if .Site.Params.analytics.bing.SiteVerificationTag }}
-
+{{- if 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 }}
{{- else }}
{{- end }}
-{{- with .Site.Params.profileMode }}
+{{- with site.Params.profileMode }}
{{- if and .enabled .imageUrl $.IsHome }}
{{- end }}
{{- end }}
-{{- with .Site.Params.label.icon }}
+{{- with site.Params.label.icon }}
{{- end }}
{{- /* Search */}}
{{- if (eq .Layout `search`) -}}
-{{- $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 }}
{{- 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 }}
@@ -96,13 +96,13 @@
{{- end }}
{{- /* Favicons */}}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
{{- /* RSS */}}
{{ range .AlternativeOutputFormats -}}
@@ -120,7 +120,7 @@
}
- {{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }}
+ {{- if (and (ne site.Params.defaultTheme "light") (ne site.Params.defaultTheme "dark")) }}