mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-10-01 01:06:14 -04:00
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:
parent
975972e041
commit
575cc0ca8c
@ -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 }}
|
||||
|
||||
|
@ -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">
|
||||
|
@ -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 }}
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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 ", " ) }}
|
||||
|
@ -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 " » " | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>
|
||||
|
@ -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) -}}
|
||||
|
@ -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 }} | {{- 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 }} | {{- 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 }}
|
||||
|
@ -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>© {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span>
|
||||
<span>© {{ 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")) {
|
||||
|
@ -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" . }}
|
||||
|
@ -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 ) }}>
|
||||
|
@ -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 -}}
|
||||
|
@ -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">
|
||||
|
@ -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) }} | {{- end -}}
|
||||
{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL site.Params.editPost.URL) }} | {{- end -}}
|
||||
<span>
|
||||
{{- (.Site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}}
|
||||
{{- (site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}}
|
||||
<a href="{{ trim .Params.canonicalURL " " }}" title="{{ trim .Params.canonicalURL " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a>
|
||||
</span>
|
||||
{{- end }}
|
||||
|
@ -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") -}}
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 -}}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{{- if .IsTranslated -}}
|
||||
{{- if (ne .Layout "search") }}
|
||||
{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }} | {{- end -}}
|
||||
{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }} | {{- 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 -}}
|
||||
|
@ -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: /
|
||||
|
Loading…
Reference in New Issue
Block a user