Phase 6 part 5, step 1: a shared site theme
internal/theme embeds a Hugo theme from federated-website's look and the 13 section types both sites share, with the header, footer, colors, font and logo set per site in hugo.toml, and a README of each type's fields. The catalogue reader reads themes' sections and READMEs after the site's own; lead forms know a theme site needs only the Lead Capture address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
{{/*
|
||||
The top bar: the logo (or the site's name), the main menu (a menu entry
|
||||
with `params.dropdown = "<menu>"` opens that menu as a panel), and the
|
||||
buttons in [params.header] ctas. Below 1000px the menu folds into a Menu
|
||||
toggle (a <details>, so it works without JS).
|
||||
*/}}
|
||||
{{ $page := . }}
|
||||
{{ $b := site.Params.brand | default dict }}
|
||||
{{ $ctas := (site.Params.header | default dict).ctas }}
|
||||
<header class="site-head">
|
||||
<div class="wrap head-bar">
|
||||
<a href="{{ "/" | relURL }}" class="brand" aria-label="{{ site.Title }}, home">
|
||||
{{ with $b.logo }}<img src="{{ . | relURL }}" alt="{{ site.Title }}" class="brand-logo">{{ else }}<span class="brand-name">{{ site.Title }}</span>{{ end }}
|
||||
</a>
|
||||
|
||||
<nav class="head-nav" aria-label="Site">
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ if ne .URL "/" }}
|
||||
{{ $m := . }}
|
||||
{{ $active := hasPrefix $page.RelPermalink .URL }}
|
||||
{{ with .Params.dropdown }}
|
||||
<div class="nav-item has-drop">
|
||||
<a href="{{ $m.URL | relURL }}" class="nav-link"{{ if $active }} aria-current="page"{{ end }}>{{ $m.Name }}<svg class="nav-caret" viewBox="0 0 10 6" width="10" height="6" aria-hidden="true"><path d="M1 1l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></a>
|
||||
<div class="drop">
|
||||
<div class="drop-panel">
|
||||
{{ range index $page.Site.Menus . }}
|
||||
<a href="{{ .URL | relURL }}" class="drop-link"{{ if eq $page.RelPermalink .URL }} aria-current="page"{{ end }}>
|
||||
<span class="drop-name">{{ .Name }}</span>
|
||||
{{ with .Params.desc }}<span class="drop-desc">{{ . }}</span>{{ end }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ else }}
|
||||
<a href="{{ $m.URL | relURL }}" class="nav-link"{{ if $active }} aria-current="page"{{ end }}>{{ $m.Name }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
{{ with $ctas }}
|
||||
<div class="head-actions">
|
||||
{{ range . }}<a href="{{ .url | relURL }}" class="{{ if eq .style "ghost" }}head-signin{{ else }}btn btn-primary btn-sm{{ end }}">{{ .label }}</a>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<details class="menu">
|
||||
<summary><span class="menu-word">Menu</span><span class="menu-glyph" aria-hidden="true"><i></i><i></i></span></summary>
|
||||
<nav class="menu-panel" aria-label="Site">
|
||||
{{ range .Site.Menus.main }}
|
||||
<a href="{{ .URL | relURL }}" class="menu-top">{{ .Name }}</a>
|
||||
{{ with .Params.dropdown }}
|
||||
<div class="menu-sub">
|
||||
{{ range index $page.Site.Menus . }}<a href="{{ .URL | relURL }}">{{ .Name }}</a>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with $ctas }}<div class="menu-actions">{{ partial "sections/ctas.html" . }}</div>{{ end }}
|
||||
</nav>
|
||||
</details>
|
||||
</div>
|
||||
</header>
|
||||
Reference in New Issue
Block a user