-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: overwrite some theme files to handle deprecations
- [x] change .Site.IsServer to hugo.IsServer (deprecated in v0.120.0, removed in v0.134.0) - [x] change .Site.IsMultilingual to hugo.IsMultilingual (deprecated in v0.124.0, removed in future release) Signed-off-by: jmeridth <[email protected]>
- Loading branch information
Showing
5 changed files
with
232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<!DOCTYPE html> | ||
<html lang="{{ .Site.Language.Lang }}"> | ||
|
||
<head> | ||
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title> | ||
{{ partial "head.html" . }} | ||
</head> | ||
|
||
{{ $csClass := "colorscheme-light" }} | ||
{{ if eq .Site.Params.colorScheme "dark" }} | ||
{{ $csClass = "colorscheme-dark" }} | ||
{{ else if eq .Site.Params.colorScheme "auto" }} | ||
{{ $csClass = "colorscheme-auto" }} | ||
{{ end }} | ||
|
||
<body class="preload-transitions {{ $csClass }}{{ if .Site.Params.rtl }} rtl{{ end }}"> | ||
{{ partial "float" . }} | ||
<main class="wrapper"> | ||
{{ partial "header.html" . }} | ||
|
||
<div class="content"> | ||
{{ block "content" . }}{{ end }} | ||
</div> | ||
|
||
{{ partial "footer.html" . }} | ||
</main> | ||
|
||
{{ if .HasShortcode "mermaid" }} | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" | ||
integrity="sha256-QdTG1YTLLTwD3b95jLqFxpQX9uYuJMNAtVZgwKX4oYU=" crossorigin="anonymous"></script> | ||
<script> | ||
mermaid.initialize({ startOnLoad: true }); | ||
</script> | ||
{{ end }} | ||
|
||
{{ if .Site.Params.disableDefaultJsScripts }} | ||
{{ if not .Site.Params.hideColorSchemeToggle }} | ||
{{ errorf "Invalid configuration. Default JS scripts are disabled, but 'hideColorSchemeToggle' is false." }} | ||
{{end}} | ||
{{ else if hugo.IsServer }} | ||
{{ $script := resources.Get "js/coder.js" }} | ||
<script src="{{ $script.RelPermalink }}"></script> | ||
{{ else }} | ||
{{ $script := resources.Get "js/coder.js" | minify | fingerprint }} | ||
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script> | ||
{{ end }} | ||
|
||
{{ range .Site.Params.customJS }} | ||
{{ if hugo.IsServer }} | ||
{{ $script := resources.Get . }} | ||
<script src="{{ $script.RelPermalink }}"></script> | ||
{{ else }} | ||
{{ $script := resources.Get . | minify | fingerprint }} | ||
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ range .Site.Params.customRemoteJS }} | ||
{{ if hugo.IsServer }} | ||
{{ $script := resources.GetRemote . }} | ||
<script src="{{ $script.RelPermalink }}"></script> | ||
{{ else }} | ||
{{ $script := resources.GetRemote . | minify | fingerprint }} | ||
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script> | ||
{{ end }} | ||
{{ end }} | ||
|
||
|
||
{{ template "_internal/google_analytics.html" . }} | ||
|
||
{{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }} | ||
{{- partial "analytics/fathom" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }} | ||
{{- partial "analytics/plausible" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.goatCounter .Site.Params.goatCounter.code }} | ||
{{- partial "analytics/goatcounter" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.cloudflare .Site.Params.cloudflare.token }} | ||
{{- partial "analytics/cloudflare" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.baidu .Site.Params.baidu.token }} | ||
{{- partial "analytics/baidu" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.wideAngleAnalytics .Site.Params.wideAngleAnalytics.siteID }} | ||
{{- partial "analytics/wideangle" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.matomo .Site.Params.matomo.serverURL }} | ||
{{- partial "analytics/matomo" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.googleTagManager .Site.Params.googleTagManager.id }} | ||
{{- partial "analytics/googletagmanager" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.applicationInsights .Site.Params.applicationInsights.connectionString }} | ||
{{- partial "analytics/applicationinsights" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.microAnalytics .Site.Params.microAnalytics.id }} | ||
{{- partial "analytics/microanalyticsio" . -}} | ||
{{ end }} | ||
|
||
{{ if .Site.Params.vercelAnalytics}} | ||
{{- partial "analytics/vercel" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.yandexMetrika .Site.Params.yandexMetrika.id }} | ||
{{- partial "analytics/yandex-metrika" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.umami .Site.Params.umami.siteID }} | ||
{{- partial "analytics/umami" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.pirsch .Site.Params.pirsch.code }} | ||
{{- partial "analytics/pirsch" . -}} | ||
{{ end }} | ||
|
||
{{ if and .Site.Params.clicky .Site.Params.clicky.id }} | ||
{{- partial "analytics/clicky" . -}} | ||
{{ end }} | ||
|
||
{{- partial "body/extensions" . -}} | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{ if or (eq .Site.Params.colorScheme "auto") (eq .Site.Params.colorScheme "dark") }} | ||
{{ if hugo.IsServer }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder-dark.css" "enableSourceMap" true ) }} | ||
{{ $styles := resources.Get "scss/coder-dark.scss" | resources.ExecuteAsTemplate "style.coder-dark.css" . | toCSS $cssOpts }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> | ||
{{ else }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder-dark.css" ) }} | ||
{{ $styles := resources.Get "scss/coder-dark.scss" | resources.ExecuteAsTemplate "style.coder-dark.css" . | toCSS $cssOpts | minify | fingerprint }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ range .Site.Params.customCSS }} | ||
{{ if hugo.IsServer }} | ||
{{ $styles := resources.Get . }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> | ||
{{ else }} | ||
{{ $styles := resources.Get . | minify | fingerprint }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ range .Site.Params.customSCSS }} | ||
{{/* We don't change the targetPath to because it's transparent to users */}} | ||
{{ if hugo.IsServer }} | ||
{{ $cssOpts := (dict "enableSourceMap" true ) }} | ||
{{ $styles := resources.Get . | toCSS $cssOpts }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> | ||
{{ else }} | ||
{{ $styles := resources.Get . | toCSS | minify | fingerprint }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<link rel="preload" href="/fonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin> | ||
<link rel="preload" href="/fonts/fa-regular-400.woff2" as="font" type="font/woff2" crossorigin> | ||
<link rel="preload" href="/fonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin> | ||
|
||
{{ if hugo.IsServer }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder.css" "enableSourceMap" true ) }} | ||
{{ $styles := resources.Get "scss/coder.scss" | resources.ExecuteAsTemplate "style.coder.css" . | toCSS $cssOpts }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> | ||
{{ else }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder.css" ) }} | ||
{{ $styles := resources.Get "scss/coder.scss" | resources.ExecuteAsTemplate "style.coder.css" . | toCSS $cssOpts | minify | fingerprint }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> | ||
{{ end }} | ||
|
||
{{ if .Site.Params.rtl }} | ||
{{ if hugo.IsServer }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder-rtl.css" "enableSourceMap" true ) }} | ||
{{ $styles := resources.Get "scss/coder-rtl.scss" | resources.ExecuteAsTemplate "style.coder-rtl.css" . | toCSS $cssOpts }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> | ||
{{ else }} | ||
{{ $cssOpts := (dict "targetPath" "css/coder-rtl.css" ) }} | ||
{{ $styles := resources.Get "scss/coder-rtl.scss" | resources.ExecuteAsTemplate "style.coder-rtl.css" . | toCSS $cssOpts | minify | fingerprint }} | ||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<nav class="navigation"> | ||
<section class="container"> | ||
{{ with .Site }} | ||
<a class="navigation-title" href="{{ absLangURL "" }}"> | ||
{{ .Title }} | ||
</a> | ||
{{ end }} | ||
{{ if or .Site.Menus.main hugo.IsMultilingual }} | ||
<input type="checkbox" id="menu-toggle" /> | ||
<label class="menu-button float-right" for="menu-toggle"> | ||
<i class="fa-solid fa-bars fa-fw" aria-hidden="true"></i> | ||
</label> | ||
<ul class="navigation-list"> | ||
{{ with .Site.Menus.main}} | ||
{{ range sort . }} | ||
<li class="navigation-item"> | ||
<a class="navigation-link {{ .Params.class }}" href="{{ index (apply (slice .URL) (.Params.urlFunc | default "relLangURL") ".") 0 }}">{{ .Name }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
{{ if hugo.IsMultilingual }} | ||
{{ $node := . }} | ||
{{ .Scratch.Set "separator" true }} | ||
{{ range (default .Site.Home.AllTranslations .Translations) }} | ||
{{ if ne $.Site.Language .Language }} | ||
{{ if $node.Scratch.Get "separator" }} | ||
<li class="navigation-item menu-separator"> | ||
<span>|</span> | ||
</li> | ||
{{ $node.Scratch.Set "separator" false }} | ||
{{ end }} | ||
<li class="navigation-item"> | ||
<a href="{{ .RelPermalink }}">{{ .Language.LanguageName | emojify }}</a> | ||
</li> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
</ul> | ||
{{ end }} | ||
</section> | ||
</nav> |