hugo-PaperMod/layouts/partials/header.html

28 lines
1002 B
HTML
Raw Normal View History

{{- if eq .Site.Params.defaultTheme "auto" }}
<script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
}
</script>
{{- end }}
2020-07-21 06:06:30 -04:00
<header class="header">
<nav class="nav">
<p class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></p>
2020-10-04 10:55:39 -04:00
{{- $currentPage := . }}
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
2020-07-21 06:06:30 -04:00
{{- range .Site.Menus.main }}
{{- $menu_item_url := .URL | relLangURL }}
{{- $page_url:= $currentPage.RelPermalink | relLangURL }}
2020-07-21 06:06:30 -04:00
<li>
<a href="{{ .URL | absLangURL }}">
<span {{- if eq $menu_item_url $page_url }}
{{- /* the menu item links to the current page (with relLangURL) */}} class="active" {{- end }}>
{{ .Name }}
</span>
</a>
2020-07-21 06:06:30 -04:00
</li>
{{- end }}
</ul>
</nav>
</header>