Import theme
This commit is contained in:
parent
51769fa6be
commit
c59ffbfeee
127 changed files with 13611 additions and 1 deletions
255
layouts/partials/head.html
Normal file
255
layouts/partials/head.html
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>
|
||||
{{ if (eq .Site.Params.reversepagetitle true) }}
|
||||
{{ with .Title }}
|
||||
{{ . }} |
|
||||
{{ end }}
|
||||
{{- .Site.Params.author -}}
|
||||
{{ else }}
|
||||
{{- .Site.Params.author -}}{{ with .Title }}
|
||||
|
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
</title>
|
||||
|
||||
<!-- Meta -->
|
||||
{{- hugo.Generator -}}
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />
|
||||
<meta name="author" content="{{ .Site.Params.author }}" />
|
||||
<meta
|
||||
name="description"
|
||||
content="{{ if .Params.description }}
|
||||
{{- .Params.description -}}
|
||||
{{ else }}
|
||||
{{- .Site.Params.description -}}
|
||||
{{ end }}"
|
||||
/>
|
||||
{{ if .Params.redirectUrl }}
|
||||
<meta http-equiv="refresh" content="1; url={{ .Params.redirectUrl }}" />
|
||||
{{ end }}
|
||||
{{- if .Site.Params.googleSiteVerify }}
|
||||
<meta name="google-site-verification" content="{{ .Site.Params.googleSiteVerify }}" />
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- CSS -->
|
||||
{{ $contentRatio := or site.Params.contentratio 0.6 -}}
|
||||
{{ $languageDirection := or site.Language.LanguageDirection "ltr" -}}
|
||||
{{ $vars := dict
|
||||
"text_direction" $languageDirection
|
||||
"content_ratio" (printf "%f%%" (mul $contentRatio 100))
|
||||
"sidebar_ratio" (printf "%f%%" (mul (sub 1.0 $contentRatio) 100))
|
||||
"content_ratio_wide" (printf "%f%%" (mul 0.8 (mul $contentRatio 100)))
|
||||
"sidebar_ratio_wide" (printf "%f%%" (mul 0.8 (mul (sub 1.0 $contentRatio) 100)))
|
||||
-}}
|
||||
{{ $options := dict
|
||||
"transpiler" "dartsass"
|
||||
"vars" $vars
|
||||
"targetPath" (printf "css/anatole%s.css" (cond (eq site.Language.LanguageDirection "") "" (printf ".%s" site.Language.LanguageDirection)))
|
||||
-}}
|
||||
{{ with resources.Get "scss/main.scss" -}}
|
||||
{{ if hugo.IsProduction -}}
|
||||
{{ with . | toCSS $options | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" />
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
{{ with . | toCSS $options }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" />
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $markupHighlightStyle := resources.Get "css/markupHighlight.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $markupHighlightStyle.RelPermalink }}"
|
||||
integrity="{{ $markupHighlightStyle.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{ range .Site.Params.customCss }}
|
||||
{{ $minstyles := resources.Get . }}
|
||||
{{ $styles := $minstyles | resources.Minify | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $styles.RelPermalink }}"
|
||||
integrity="{{ $styles.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
media="screen"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ $style := resources.Get "fontawesome/css/fontawesome.min.css" | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $style.RelPermalink }}"
|
||||
integrity="{{ $style.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{ $style := resources.Get "fontawesome/css/solid.min.css" | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $style.RelPermalink }}"
|
||||
integrity="{{ $style.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{ $style := resources.Get "fontawesome/css/regular.min.css" | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $style.RelPermalink }}"
|
||||
integrity="{{ $style.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{ $style := resources.Get "fontawesome/css/brands.min.css" | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $style.RelPermalink }}"
|
||||
integrity="{{ $style.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{ if .Params.redirectUrl }}
|
||||
{{ $style := resources.Get "css/spinner.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $style.RelPermalink }}"
|
||||
integrity="{{ $style.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
type="text/css"
|
||||
/>
|
||||
{{- end -}}
|
||||
{{ if .Site.Params.googleFonts }}
|
||||
{{ $baseUrl := "https://fonts.googleapis.com/css2?family=" }}
|
||||
{{ $fontParam := delimit .Site.Params.googleFonts "&family=" }}
|
||||
{{ $url := printf "%s" "&display=swap" | printf "%s%s" $fontParam | printf "%s%s" $baseUrl | printf "%s" }}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="{{ $url }}" rel="stylesheet" />
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="shortcut icon" href="{{ .Site.Params.favicon | relURL }}favicon.ico" type="image/x-icon" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon | relURL }}apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon | relURL }}favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.favicon | relURL }}favicon-16x16.png" />
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
<!-- License -->
|
||||
{{- with .Site.Params.license -}}
|
||||
<link rel="license" href="{{ . }}" />
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- RSS -->
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
|
||||
<!-- JavaScript -->
|
||||
{{ $anatoleHeader := resources.Get "js/anatole-header.js" }}
|
||||
{{ $secureHeaderJS := $anatoleHeader | resources.Minify | resources.Fingerprint }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $secureHeaderJS.RelPermalink }}"
|
||||
integrity="{{ $secureHeaderJS.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
{{ if not .Site.Params.disableThemeSwitcher }}
|
||||
{{ $anatoleThemeSwitcher := resources.Get "js/anatole-theme-switcher.js" }}
|
||||
{{ $secureThemeSwitcherJS := $anatoleThemeSwitcher | resources.Minify | resources.Fingerprint }}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $secureThemeSwitcherJS.RelPermalink }}"
|
||||
integrity="{{ $secureThemeSwitcherJS.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{{ end }}
|
||||
|
||||
{{- $js := "" -}}
|
||||
{{- range .Site.Params.customJs -}}
|
||||
{{- if or (in . "http://") (in . "https://") -}}
|
||||
<script src="{{ . | relURL }}"></script>
|
||||
{{- else -}}
|
||||
{{- $customJS := resources.Get . -}}
|
||||
{{- if $customJS -}}
|
||||
{{- if eq $js "" -}}
|
||||
{{- $js = $customJS -}}
|
||||
{{- else -}}
|
||||
{{- $js = slice $js $customJS | resources.Concat "js/custom.js" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- if ne $js "" -}}
|
||||
{{- $secureJS := $js | resources.Minify | resources.Fingerprint -}}
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ $secureJS.RelPermalink }}"
|
||||
integrity="{{ $secureJS.Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{{- end -}}
|
||||
|
||||
{{ if and hugo.IsProduction .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }}
|
||||
{{- partial "analytics/plausible" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if and hugo.IsProduction .Site.Params.umami.serverURL .Site.Params.umami.id }}
|
||||
{{- partial "analytics/umami" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if and hugo.IsProduction .Site.Params.Matomo.instance .Site.Params.Matomo.siteId }}
|
||||
{{- partial "analytics/matomo" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if and hugo.IsProduction .Site.Params.meta.pixelId }}
|
||||
{{- partial "analytics/meta.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<!-- Twitter Cards -->
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
||||
|
||||
<!-- Open Graph -->
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
|
||||
|
||||
<!-- Schema.org-->
|
||||
{{ partial "schema.html" . }}
|
||||
|
||||
|
||||
<!-- KaTeX-->
|
||||
{{ $noop := .WordCount }}
|
||||
{{ if .Page.Store.Get "hasMath" }}
|
||||
{{ $katex_css_url := printf "https://cdn.jsdelivr.net/npm/katex@latest/dist/katex%s.css" (cond hugo.IsProduction ".min" "") -}}
|
||||
{{ with try (resources.GetRemote $katex_css_url) -}}
|
||||
{{ with .Err -}}
|
||||
{{ errorf "Could not retrieve KaTeX css file from CDN. Reason: %s." . -}}
|
||||
{{ else with.Value -}}
|
||||
{{ with resources.Copy (printf "css/katex%s.css" (cond hugo.IsProduction ".min" "")) . }}
|
||||
{{ $secureCSS := . | resources.Fingerprint "sha512" -}}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{- .RelPermalink -}}"
|
||||
integrity="{{- $secureCSS.Data.Integrity -}}"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
</head>
|
||||
Loading…
Add table
Add a link
Reference in a new issue