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.
This commit is contained in:
Aditya Telange 2022-03-27 18:44:06 +05:30
parent 975972e041
commit 575cc0ca8c
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
23 changed files with 115 additions and 115 deletions

View File

@ -11,7 +11,7 @@
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if .Site.Params.ShowAllPagesInArchive }} {{- if site.Params.ShowAllPagesInArchive }}
{{- $pages = site.RegularPages }} {{- $pages = site.RegularPages }}
{{- end }} {{- end }}

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}"> <html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}">
<head> <head>
{{- partial "head.html" . }} {{- partial "head.html" . }}
@ -9,7 +9,7 @@
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}} {{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
{{- print "list" -}} {{- print "list" -}}
{{- end -}} {{- end -}}
{{- if eq $.Site.Params.defaultTheme `dark` -}} {{- if eq site.Params.defaultTheme `dark` -}}
{{- print " dark" }} {{- print " dark" }}
{{- end -}} {{- end -}}
" id="top"> " id="top">

View File

@ -1,5 +1,5 @@
{{- $.Scratch.Add "index" slice -}} {{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}} {{- range site.RegularPages -}}
{{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }} {{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }}
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}} {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end }} {{- end }}

View File

@ -1,6 +1,6 @@
{{- define "main" }} {{- define "main" }}
{{- if (and .Site.Params.profileMode.enabled .IsHome) }} {{- if (and site.Params.profileMode.enabled .IsHome) }}
{{- partial "index_profile.html" . }} {{- partial "index_profile.html" . }}
{{- else }} {{/* if not profileMode */}} {{- else }} {{/* if not profileMode */}}
@ -32,7 +32,7 @@
{{- $paginator := .Paginate $pages }} {{- $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" . }} {{- partial "home_info.html" . }}
{{- end }} {{- end }}
@ -41,7 +41,7 @@
{{- $class := "post-entry" }} {{- $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)) }} {{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }}
{{- $class = "first-entry" }} {{- $class = "first-entry" }}
{{- else if $term }} {{- else if $term }}
@ -49,7 +49,7 @@
{{- end }} {{- end }}
<article class="{{ $class }}"> <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) }} {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }}
<header class="entry-header"> <header class="entry-header">
<h2> <h2>

View File

@ -1,31 +1,31 @@
{{- $pctx := . -}} {{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- if .IsHome -}}{{ $pctx = site }}{{- end -}}
{{- $pages := slice -}} {{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}} {{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}} {{- $pages = $pctx.RegularPages -}}
{{- else -}} {{- else -}}
{{- $pages = $pctx.Pages -}} {{- $pages = $pctx.Pages -}}
{{- end -}} {{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}} {{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}
{{- end -}} {{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- 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/"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel> <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> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description>
{{- with $.Site.Params.images }} {{- with site.Params.images }}
<image> <image>
<url>{{ index . 0 | absURL }}</url> <url>{{ index . 0 | absURL }}</url>
<link>{{ index . 0 | absURL }}</link> <link>{{ index . 0 | absURL }}</link>
</image> </image>
{{- end }} {{- end }}
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{ with site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{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 }} <webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}} {{- with .OutputFormats.Get "RSS" -}}
@ -37,10 +37,10 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <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> <guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> <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> <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- end }} {{- end }}
</item> </item>

View File

@ -21,7 +21,7 @@
</div> </div>
{{- end }} {{- end }}
</header> </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) }} {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }}
{{- if (.Param "ShowToc") }} {{- if (.Param "ShowToc") }}
{{- partial "toc.html" . }} {{- partial "toc.html" . }}
@ -46,7 +46,7 @@
{{- if (.Param "ShowPostNavLinks") }} {{- if (.Param "ShowPostNavLinks") }}
{{- partial "post_nav_links.html" . }} {{- partial "post_nav_links.html" . }}
{{- end }} {{- end }}
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }} {{- if (and site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
{{- partial "share_icons.html" . -}} {{- partial "share_icons.html" . -}}
{{- end }} {{- end }}
</footer> </footer>

View File

@ -16,7 +16,7 @@
{{- range $key, $value := .Data.Terms.Alphabetical }} {{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }} {{- $name := .Name }}
{{- $count := .Count }} {{- $count := .Count }}
{{- with $.Site.GetPage (printf "/%s/%s" $type $name) }} {{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li> <li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a> <a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li> </li>

View File

@ -1,5 +1,5 @@
{{- if or .Params.author .Site.Params.author }} {{- if or .Params.author site.Params.author }}
{{- $author := (.Params.author | default .Site.Params.author) }} {{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }} {{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }} {{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }} {{- (delimit $author ", " ) }}

View File

@ -1,6 +1,6 @@
{{- if (.Param "ShowBreadCrumbs") -}} {{- if (.Param "ShowBreadCrumbs") -}}
<div class="breadcrumbs"> <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 -}} {{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a> <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a>
@ -8,7 +8,7 @@
{{- range $index, $element := split $lang_url "/" }} {{- range $index, $element := split $lang_url "/" }}
{{- $scratch.Add "path" (printf "%s/" $element )}} {{- $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))}} {{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a> {{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>

View File

@ -2,8 +2,8 @@
{{- if (and .Params.cover.image (not $.isHidden)) }} {{- if (and .Params.cover.image (not $.isHidden)) }}
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
<figure class="entry-cover"> <figure class="entry-cover">
{{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }} {{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
{{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }} {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }}
{{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
{{- if $cover -}}{{/* i.e it is present in page bundle */}} {{- if $cover -}}{{/* i.e it is present in page bundle */}}
{{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" {{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank"
@ -13,7 +13,7 @@
{{- if hugo.IsExtended -}} {{- if hugo.IsExtended -}}
{{- $processableFormats = $processableFormats | append "webp" -}} {{- $processableFormats = $processableFormats | append "webp" -}}
{{- end -}} {{- 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)) }} {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }}
<img loading="lazy" srcset="{{- range $size := $sizes -}} <img loading="lazy" srcset="{{- range $size := $sizes -}}
{{- if (ge $cover.Width $size) -}} {{- if (ge $cover.Width $size) -}}

View File

@ -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 }} {{- $fileUrlPath := path.Join .File.Path }}
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}} {{- 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"> <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")) -}} {{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
</a> </a>
{{- end }} {{- end }}

View File

@ -1,9 +1,9 @@
{{- if not (.Param "hideFooter") }} {{- if not (.Param "hideFooter") }}
<footer class="footer"> <footer class="footer">
{{- if .Site.Copyright }} {{- if site.Copyright }}
<span>{{ .Site.Copyright | markdownify }}</span> <span>{{ site.Copyright | markdownify }}</span>
{{- else }} {{- else }}
<span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span> <span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ site.Title }}</a></span>
{{- end }} {{- end }}
<span> <span>
Powered by Powered by
@ -13,7 +13,7 @@
</footer> </footer>
{{- end }} {{- 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"> <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"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
<path d="M12 6H0l6-6z" /> <path d="M12 6H0l6-6z" />
@ -53,7 +53,7 @@
</script> </script>
{{- if (not .Site.Params.disableScrollToTop) }} {{- if (not site.Params.disableScrollToTop) }}
<script> <script>
var mybutton = document.getElementById("top-link"); var mybutton = document.getElementById("top-link");
window.onscroll = function () { window.onscroll = function () {
@ -69,7 +69,7 @@
</script> </script>
{{- end }} {{- end }}
{{- if (not .Site.Params.disableThemeToggle) }} {{- if (not site.Params.disableThemeToggle) }}
<script> <script>
document.getElementById("theme-toggle").addEventListener("click", () => { document.getElementById("theme-toggle").addEventListener("click", () => {
if (document.body.className.includes("dark")) { if (document.body.className.includes("dark")) {

View File

@ -1,36 +1,36 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <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"> <meta name="robots" content="index, follow">
{{- else }} {{- else }}
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
{{- end }} {{- end }}
{{- /* Title */}} {{- /* 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 */}} {{- /* Meta */}}
{{- if .IsHome }} {{- 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 }} {{- else }}
<meta name="keywords" content="{{ if .Params.keywords -}} <meta name="keywords" content="{{ if .Params.keywords -}}
{{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }} {{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }}
{{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}" /> {{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}" />
{{- end }} {{- end }}
<meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if or .IsPage .IsSection}} <meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if or .IsPage .IsSection}}
{{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }} {{- .Summary | default (printf "%s - %s" .Title site.Title) }}{{- else }}
{{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}"> {{- with site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
<meta name="author" content="{{ (partial "author.html" . ) }}"> <meta name="author" content="{{ (partial "author.html" . ) }}">
<link rel="canonical" href="{{ if .Params.canonicalURL -}} {{ trim .Params.canonicalURL " " }} {{- else -}} {{ .Permalink }} {{- end }}" /> <link rel="canonical" href="{{ if .Params.canonicalURL -}} {{ trim .Params.canonicalURL " " }} {{- else -}} {{ .Permalink }} {{- end }}" />
{{- if .Site.Params.analytics.google.SiteVerificationTag }} {{- if site.Params.analytics.googlesiteVerificationTag }}
<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" /> <meta name="google-site-verification" content="{{ site.Params.analytics.googlesiteVerificationTag }}" />
{{- end }} {{- end }}
{{- if .Site.Params.analytics.yandex.SiteVerificationTag }} {{- if site.Params.analytics.yandexsiteVerificationTag }}
<meta name="yandex-verification" content="{{ .Site.Params.analytics.yandex.SiteVerificationTag }}" /> <meta name="yandex-verification" content="{{ site.Params.analytics.yandexsiteVerificationTag }}" />
{{- end }} {{- end }}
{{- if .Site.Params.analytics.bing.SiteVerificationTag }} {{- if site.Params.analytics.bingsiteVerificationTag }}
<meta name="msvalidate.01" content="{{ .Site.Params.analytics.bing.SiteVerificationTag }}" /> <meta name="msvalidate.01" content="{{ site.Params.analytics.bingsiteVerificationTag }}" />
{{- end }} {{- end }}
{{- /* Styles */}} {{- /* Styles */}}
@ -40,7 +40,7 @@
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} {{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
{{- /* include `an-old-hope` if hljs is on */}} {{- /* 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")) }} {{- $hljs := (cond ($isHLJSdisabled) (" " | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }}
{{- /* order is important */}} {{- /* order is important */}}
@ -51,29 +51,29 @@
{{- /* Add extended css after theme style */ -}} {{- /* Add extended css after theme style */ -}}
{{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} {{- $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 }} {{- $stylesheet := $stylesheet | fingerprint }}
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style"> <link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style">
{{- else }} {{- else }}
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style"> <link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
{{- end }} {{- end }}
{{- with .Site.Params.profileMode }} {{- with site.Params.profileMode }}
{{- if and .enabled .imageUrl $.IsHome }} {{- if and .enabled .imageUrl $.IsHome }}
<link rel="preload" href="{{ .imageUrl }}" as="image"> <link rel="preload" href="{{ .imageUrl }}" as="image">
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- with .Site.Params.label.icon }} {{- with site.Params.label.icon }}
<link rel="preload" href="{{ . }}" as="image"> <link rel="preload" href="{{ . }}" as="image">
{{- end }} {{- end }}
{{- /* Search */}} {{- /* Search */}}
{{- if (eq .Layout `search`) -}} {{- if (eq .Layout `search`) -}}
<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json"> <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" }} {{- $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 }} {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script> <script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
{{- else }} {{- else }}
@ -83,9 +83,9 @@
{{- end -}} {{- end -}}
{{- /* Highlight.js */}} {{- /* 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 (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 }} {{- $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 }}" <script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}"
onload="hljs.initHighlightingOnLoad();"></script> onload="hljs.initHighlightingOnLoad();"></script>
@ -96,13 +96,13 @@
{{- end }} {{- end }}
{{- /* Favicons */}} {{- /* Favicons */}}
<link rel="icon" href="{{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}"> <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="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="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="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 }}"> <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="theme-color" content="{{ site.Params.assets.theme_color | default "#2e2e33" }}">
<meta name="msapplication-TileColor" content="{{ .Site.Params.assets.msapplication_TileColor | default "#2e2e33" }}"> <meta name="msapplication-TileColor" content="{{ site.Params.assets.msapplication_TileColor | default "#2e2e33" }}">
{{- /* RSS */}} {{- /* RSS */}}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
@ -120,7 +120,7 @@
} }
</style> </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> <style>
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
@ -155,7 +155,7 @@
{{- partial "extend_head.html" . -}} {{- partial "extend_head.html" . -}}
{{- /* Misc */}} {{- /* 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 "_internal/google_analytics.html" . }}
{{- template "partials/templates/opengraph.html" . }} {{- template "partials/templates/opengraph.html" . }}
{{- template "partials/templates/twitter_cards.html" . }} {{- template "partials/templates/twitter_cards.html" . }}

View File

@ -1,7 +1,7 @@
{{- /* theme-toggle is enabled */}} {{- /* theme-toggle is enabled */}}
{{- if (not .Site.Params.disableThemeToggle) }} {{- if (not site.Params.disableThemeToggle) }}
{{- /* theme is light */}} {{- /* theme is light */}}
{{- if (eq .Site.Params.defaultTheme "light") }} {{- if (eq site.Params.defaultTheme "light") }}
<script> <script>
if (localStorage.getItem("pref-theme") === "dark") { if (localStorage.getItem("pref-theme") === "dark") {
document.body.classList.add('dark'); document.body.classList.add('dark');
@ -9,7 +9,7 @@
</script> </script>
{{- /* theme is dark */}} {{- /* theme is dark */}}
{{- else if (eq .Site.Params.defaultTheme "dark") }} {{- else if (eq site.Params.defaultTheme "dark") }}
<script> <script>
if (localStorage.getItem("pref-theme") === "light") { if (localStorage.getItem("pref-theme") === "light") {
document.body.classList.remove('dark') document.body.classList.remove('dark')
@ -30,7 +30,7 @@
</script> </script>
{{- end }} {{- end }}
{{- /* theme-toggle is disabled and theme is auto */}} {{- /* 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> <script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) { if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark'); document.body.classList.add('dark');
@ -42,18 +42,18 @@
<header class="header"> <header class="header">
<nav class="nav"> <nav class="nav">
<div class="logo"> <div class="logo">
{{- $label_text := (.Site.Params.label.text | default .Site.Title) }} {{- $label_text := (site.Params.label.text | default site.Title) }}
{{- if .Site.Title }} {{- if site.Title }}
<a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)"> <a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)">
{{- if .Site.Params.label.icon }} {{- if site.Params.label.icon }}
<img src="{{- .Site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo" <img src="{{- site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo"
height="{{- .Site.Params.label.iconHeight | default "30" -}}"> height="{{- site.Params.label.iconHeight | default "30" -}}">
{{- end -}} {{- end -}}
{{- $label_text -}} {{- $label_text -}}
</a> </a>
{{- end }} {{- end }}
<span class="logo-switches"> <span class="logo-switches">
{{- if (not .Site.Params.disableThemeToggle) }} {{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" accesskey="t" title="(Alt + T)"> <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" <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" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
@ -77,8 +77,8 @@
{{- end }} {{- end }}
{{- $lang := .Lang}} {{- $lang := .Lang}}
{{- $separator := or $label_text (not .Site.Params.disableThemeToggle)}} {{- $separator := or $label_text (not site.Params.disableThemeToggle)}}
{{- with $.Site.Home.AllTranslations }} {{- with site.Home.AllTranslations }}
<ul class="lang-switch"> <ul class="lang-switch">
{{- if $separator }}<li>|</li>{{ end }} {{- if $separator }}<li>|</li>{{ end }}
{{- range . -}} {{- range . -}}
@ -86,7 +86,7 @@
<li> <li>
<a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}" <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}"
aria-label="{{ .Language.LanguageName | 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 -}} {{- .Language.LanguageName | emojify -}}
{{- else }} {{- else }}
{{- .Lang | title -}} {{- .Lang | title -}}
@ -101,10 +101,10 @@
</div> </div>
{{- $currentPage := . }} {{- $currentPage := . }}
<ul id="menu"> <ul id="menu">
{{- range .Site.Menus.main }} {{- range site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }} {{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
{{- $page_url:= $currentPage.Permalink | absLangURL }} {{- $page_url:= $currentPage.Permalink | absLangURL }}
{{- $is_search := eq ($.Site.GetPage .KeyName).Layout `search` }} {{- $is_search := eq (site.GetPage .KeyName).Layout `search` }}
<li> <li>
<a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}" <a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
{{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}> {{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>

View File

@ -1,4 +1,4 @@
{{- with $.Site.Params.homeInfoParams }} {{- with site.Params.homeInfoParams }}
<article class="first-entry home-info"> <article class="first-entry home-info">
<header class="entry-header"> <header class="entry-header">
<h1>{{ .Title | markdownify }}</h1> <h1>{{ .Title | markdownify }}</h1>
@ -7,7 +7,7 @@
<p>{{ .Content | markdownify }}</p> <p>{{ .Content | markdownify }}</p>
</section> </section>
<footer class="entry-footer"> <footer class="entry-footer">
{{ partial "social_icons.html" $.Site.Params.socialIcons }} {{ partial "social_icons.html" site.Params.socialIcons }}
</footer> </footer>
</article> </article>
{{- end -}} {{- end -}}

View File

@ -1,13 +1,13 @@
<div class="profile"> <div class="profile">
{{- with .Site.Params.profileMode }} {{- with site.Params.profileMode }}
<div class="profile_inner"> <div class="profile_inner">
{{- if .imageUrl -}} {{- if .imageUrl -}}
<img src="{{ .imageUrl | absURL }}" alt="{{ .imageTitle | default "profile image" }}" <img src="{{ .imageUrl | absURL }}" alt="{{ .imageTitle | default "profile image" }}"
height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" /> height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" />
{{- end }} {{- end }}
<h1>{{ .title | default $.Site.Title | markdownify }}</h1> <h1>{{ .title | default site.Title | markdownify }}</h1>
<span>{{ .subtitle | markdownify }}</span> <span>{{ .subtitle | markdownify }}</span>
{{- partial "social_icons.html" $.Site.Params.socialIcons -}} {{- partial "social_icons.html" site.Params.socialIcons -}}
{{- with .buttons }} {{- with .buttons }}
<div class="buttons"> <div class="buttons">

View File

@ -1,9 +1,9 @@
{{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}} {{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}}
{{ $url := urls.Parse .Params.canonicalURL }} {{ $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> <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> &nbsp;<a href="{{ trim .Params.canonicalURL " " }}" title="{{ trim .Params.canonicalURL " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a>
</span> </span>
{{- end }} {{- end }}

View File

@ -1,7 +1,7 @@
{{- $scratch := newScratch }} {{- $scratch := newScratch }}
{{- if not .Date.IsZero -}} {{- 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 }} {{- end }}
{{- if (.Param "ShowReadingTime") -}} {{- if (.Param "ShowReadingTime") -}}

View File

@ -1,5 +1,5 @@
<meta property="og:title" content="{{ .Title }}" /> <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:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}" />
{{- if .Params.cover.image -}} {{- if .Params.cover.image -}}
@ -19,7 +19,7 @@
{{- with $featured -}} {{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/> <meta property="og:image" content="{{ $featured.Permalink }}"/>
{{- else -}} {{- 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 -}} {{- end -}}
{{- end }} {{- end }}
@ -33,14 +33,14 @@
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
{{- with .Params.locale }}<meta property="og:locale" 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 . }} {{- with .Params.videos }}{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" /> <meta property="og:video" content="{{ . | absURL }}" />
{{ end }}{{ end }} {{ end }}{{ end }}
{{- /* If it is part of a series, link to related articles */}} {{- /* If it is part of a series, link to related articles */}}
{{- $permalink := .Permalink }} {{- $permalink := .Permalink }}
{{- $siteSeries := .Site.Taxonomies.series }} {{- $siteSeries := site.Taxonomies.series }}
{{ with .Params.series }}{{- range $name := . }} {{ with .Params.series }}{{- range $name := . }}
{{- $series := index $siteSeries ($name | urlize) }} {{- $series := index $siteSeries ($name | urlize) }}
{{- range $page := first 6 $series.Pages }} {{- range $page := first 6 $series.Pages }}
@ -49,4 +49,4 @@
{{ end }}{{ end }} {{ end }}{{ end }}
{{- /* Facebook Page Admin ID for Domain Insights */}} {{- /* 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 }}

View File

@ -2,23 +2,23 @@
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
"name": {{ .Site.Title }}, "name": {{ site.Title }},
"url": {{ .Site.BaseURL }}, "url": {{ site.BaseURL }},
"description": {{ .Site.Params.description | plainify | truncate 180 | safeHTML }}, "description": {{ site.Params.description | plainify | truncate 180 | safeHTML }},
"thumbnailUrl": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}, "thumbnailUrl": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }},
"sameAs": [ "sameAs": [
{{- if .Site.Params.schema.sameAs }} {{- if site.Params.schema.sameAs }}
{{ range $i, $e := .Site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }} {{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }}
{{- else}} {{- 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}} {{- end}}
] ]
} }
</script> </script>
{{- else if (or .IsPage .IsSection) }} {{- else if (or .IsPage .IsSection) }}
{{/* BreadcrumbList */}} {{/* 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 }} {{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
{{- $bc_list := (split $lang_url "/")}} {{- $bc_list := (split $lang_url "/")}}
@ -31,7 +31,7 @@
{{- range $index, $element := $bc_list }} {{- range $index, $element := $bc_list }}
{{- $scratch.Add "path" (printf "%s/" $element ) | safeJS }} {{- $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 ($bc_pg) (gt (len . ) 0))}}
{{- if (and $index)}}, {{end }} {{- if (and $index)}}, {{end }}
@ -83,7 +83,7 @@
{{- end -}} {{- end -}}
"datePublished": {{ .PublishDate }}, "datePublished": {{ .PublishDate }},
"dateModified": {{ .Lastmod }}, "dateModified": {{ .Lastmod }},
{{- with (.Params.author | default .Site.Params.author) }} {{- with (.Params.author | default site.Params.author) }}
"author": "author":
{{- if (or (eq (printf "%T" .) "[]string") (eq (printf "%T" .) "[]interface {}")) -}} {{- if (or (eq (printf "%T" .) "[]string") (eq (printf "%T" .) "[]interface {}")) -}}
[{{- range $i, $v := . -}} [{{- range $i, $v := . -}}
@ -105,11 +105,11 @@
"@id": {{ .Permalink | safeHTML }} "@id": {{ .Permalink | safeHTML }}
}, },
"publisher": { "publisher": {
"@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}",
"name": {{ .Site.Title }}, "name": {{ site.Title }},
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }} "url": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }}
} }
} }
} }

View File

@ -17,7 +17,7 @@
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/> <meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}} {{- else -}}
{{- with $.Site.Params.images -}} {{- with site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}} {{ else -}}
@ -27,7 +27,7 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
<meta name="twitter:title" content="{{ .Title }}"/> <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 -}}"/> <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}} {{ with site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/> <meta name="twitter:site" content="@{{ . }}"/>
{{ end -}} {{ end -}}

View File

@ -1,13 +1,13 @@
{{- if .IsTranslated -}} {{- if .IsTranslated -}}
{{- if (ne .Layout "search") }} {{- 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 }} {{- end }}
<ul class="i18n_list"> <ul class="i18n_list">
{{- i18n "translations" | default "Translations" }}: {{- i18n "translations" | default "Translations" }}:
{{- range .Translations }} {{- range .Translations }}
<li> <li>
<a href="{{ .Permalink }}"> <a href="{{ .Permalink }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} {{- if (and site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}} {{- .Language.LanguageName | emojify -}}
{{- else }} {{- else }}
{{- .Lang | title -}} {{- .Lang | title -}}

View File

@ -1,5 +1,5 @@
User-agent: * User-agent: *
{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} {{- if hugo.IsProduction | or (eq site.Params.env "production") }}
Disallow: Disallow:
{{- else }} {{- else }}
Disallow: / Disallow: /