aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAnthony Wang2024-01-05 20:12:15 -0600
committerAnthony Wang2024-01-05 20:12:15 -0600
commitcafbacfd3beed9b56760025548353cafbaf9f3bf (patch)
treec76ffb0ecd4f3412a585462d0fec7f45538992ad /layouts
parent8066e4eab3082e80e92ed27055a89747ff906707 (diff)
Customize the nav-title using the first portion of the relative URL
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/header.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..22db943
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,67 @@
+<header class="header">
+ <nav class="header-nav">
+
+ {{ if isset .Site.Params "avatarurl" }}
+ <div class="avatar">
+ <a href="{{ .Site.BaseURL }}">
+ <img src='{{ .Scratch.Get "avatarImgSrc" }}' alt="{{ .Site.Params.AvatarAltText|default "avatar" }}" />
+ </a>
+ </div>
+ {{ end }}
+
+ <div class="nav-title">
+ <a class="nav-brand" href="{{ .Site.BaseURL }}">
+ {{ if .IsHome }}
+ Some Random Website
+ {{ else if eq .RelPermalink "/404.html" }}
+ Some Random 404
+ {{ else }}
+ Some Random {{ humanize (index (split .RelPermalink "/") 1) }}
+ {{ end }}
+ </a>
+ </div>
+
+ <div class="nav-links">
+ {{ range .Site.Menus.main }}
+ <div class="nav-link">
+ <a href="{{ .URL | absURL }}" {{- if .Params.NewPage -}}target="_blank"{{- end -}}>
+ {{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
+ </a>
+ </div>
+ {{ end }}
+
+ <span class="nav-icons-divider"></span>
+ <div class="nav-link dark-theme-toggle">
+ <span id="dark-theme-toggle-screen-reader-target" class="sr-only"></span>
+ <a>
+ <span id="theme-toggle-icon" data-feather="moon"></span>
+ </a>
+ </div>
+
+ <div class="nav-link" id="hamburger-menu-toggle">
+ <span id="hamburger-menu-toggle-screen-reader-target" class="sr-only">menu</span>
+ <a>
+ <span data-feather="menu"></span>
+ </a>
+ </div>
+
+ <!-- For mobile -->
+ <ul class="nav-hamburger-list visibility-hidden">
+ {{ range .Site.Menus.main }}
+ <li class="nav-item">
+ <a href="{{ .URL | absURL }}" {{- if .Params.NewPage -}}target="_blank"{{- end -}}>
+ {{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
+ </a>
+ </li>
+ {{ end }}
+ <li class="nav-item dark-theme-toggle">
+ <span id="dark-theme-toggle-screen-reader-target" class="sr-only">theme</span>
+ <a>
+ <span id="theme-toggle-icon" data-feather="moon"></span>
+ </a>
+ </li>
+ </ul>
+
+ </div>
+ </nav>
+</header>