2eef3fcc12
usage: add to config params: defaultTheme: "auto"
25 lines
788 B
HTML
25 lines
788 B
HTML
{{ if eq .Site.Params.defaultTheme "auto" }}
|
|
<script>
|
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
document.body.classList.add('dark');
|
|
}
|
|
</script>
|
|
{{ end }}
|
|
<header class="header">
|
|
<nav class="nav">
|
|
{{- if .IsHome }}
|
|
<h1 class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></h1>
|
|
{{- else }}
|
|
<p class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></p>
|
|
{{- end }}
|
|
{{- if .Site.Menus.main }}
|
|
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
|
|
{{- range .Site.Menus.main }}
|
|
<li>
|
|
<a href="{{ .URL | absLangURL}}">{{ .Name }}</a>
|
|
</li>
|
|
{{- end }}
|
|
</ul>
|
|
{{- end }}
|
|
</nav>
|
|
</header> |