hugo-toha/layouts/_default/baseof.html
JY Hsu 7bc37c74c7
Added default theme (#960)
* feat: Added default theme

* Revert "feat: Added default theme"

This reverts commit a11a99f92a.

* feat: Add basic theme feature

* feat: Add theme settings

* fix: Fix default theme value

* fix: Fix CR and doc-string

* Comment out darkMode on exampleSite/hugo.yaml

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

---------

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
2024-09-06 16:15:33 +06:00

56 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
<head>
<title>{{ .Page.Title }}</title>
<!------ ADD COMMON HEADERS -------->
{{- partial "header.html" . -}}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
<!------ ADD PAGE SPECIFIC HEADERS ------->
{{ block "header" . }} {{ end }}
<!--================= add analytics if enabled =========================-->
{{- partial "analytics.html" . -}}
<script>
theme = localStorage.getItem('theme-scheme') || localStorage.getItem('darkmode:color-scheme') || 'light';
if (theme == 'system') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = 'dark';
} else {
theme = 'light';
}
}
document.documentElement.setAttribute('data-theme', theme);
</script>
</head>
<body class="type-{{ .Page.Type }} kind-{{ .Page.Kind }}" data-bs-spy="scroll" data-bs-target="#TableOfContents" data-bs-offset="80">
<div class="container-fluid bg-secondary wrapper">
<!----- ADD NAVBAR --------------->
{{ block "navbar" . }} {{ end }}
<!----- ADD SIDEBAR --------------->
{{ block "sidebar" . }} {{ end }}
<!----- ADD PAGE CONTENT --------->
{{ block "content" . }} {{ end }}
<!----- ADD TABLE OF CONTENTS ----------->
{{ block "toc" . }} {{ end }}
</div>
<!------- ADD FOOTER ------------>
{{ $footerTemplate:= site.Params.footer.template | default "footer.html" }}
{{- partial $footerTemplate . -}}
<!------- ADD COMMON SCRIPTS ------->
{{ partial "scripts.html" . }}
<!------- ADD PAGE SPECIFIC SCRIPTS ------>
{{ block "scripts" . }} {{ end }}
<!------ IF WANTED, ADD SUPPORT LINKS -------->
{{- partial "misc/support.html" . -}}
</body>
</html>