body direct children: <nav>, <header>, <article role="main">, <footer> - <nav>: site navigation (own landmark) - <header>: page identity — title, author, date, metadata - <article role="main">: content (screen reader gets landmark via role) - <footer>: site footer No <main> wrapper. Fewer tags, clearer signal. Header block defined per-layout (prose gets eyebrow/date, docs gets hgroup). Content block defined per-layout (docs adds sidebar <nav> + <aside> TOC).
87 lines
2.1 KiB
HTML
87 lines
2.1 KiB
HTML
{{ define "header" }}
|
|
<header>
|
|
{{- if .Description -}}
|
|
<hgroup>
|
|
<h1>{{ .Title }}</h1>
|
|
<p>{{ .Description }}</p>
|
|
</hgroup>
|
|
{{- else -}}
|
|
<h1>{{ .Title }}</h1>
|
|
{{- end }}
|
|
</header>
|
|
{{ end }}
|
|
|
|
{{ define "content" }}
|
|
{{/* Docs sidebar — this is navigation, not an aside */}}
|
|
<nav aria-label="Documentation" data-nav="sidebar">
|
|
{{- $menu := index .Site.Menus "docs" -}}
|
|
{{- if $menu -}}
|
|
{{- range $menu -}}
|
|
{{- if .HasChildren -}}
|
|
<small>{{ .Name }}</small>
|
|
<ul>
|
|
{{- range .Children -}}
|
|
<li>
|
|
<a href="{{ .URL }}"
|
|
{{- if eq (relURL .URL) $.RelPermalink }} aria-current="page"{{ end -}}>
|
|
{{- .Name -}}
|
|
</a>
|
|
</li>
|
|
{{- end -}}
|
|
</ul>
|
|
{{- else -}}
|
|
<ul>
|
|
<li>
|
|
<a href="{{ .URL }}"
|
|
{{- if eq (relURL .URL) $.RelPermalink }} aria-current="page"{{ end -}}>
|
|
{{- .Name -}}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- with .CurrentSection -}}
|
|
<small>{{ .Title }}</small>
|
|
<ul>
|
|
{{- range .RegularPages -}}
|
|
<li>
|
|
<a href="{{ .RelPermalink }}"
|
|
{{- if eq .RelPermalink $.RelPermalink }} aria-current="page"{{ end -}}>
|
|
{{- .LinkTitle -}}
|
|
</a>
|
|
</li>
|
|
{{- end -}}
|
|
</ul>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
</nav>
|
|
|
|
<article role="main">
|
|
{{ .Content }}
|
|
|
|
{{- if or .PrevInSection .NextInSection -}}
|
|
<footer data-role="prev-next">
|
|
{{- with .NextInSection -}}
|
|
<a href="{{ .RelPermalink }}" rel="prev">
|
|
<small>← Previous</small>
|
|
<span>{{ .LinkTitle }}</span>
|
|
</a>
|
|
{{- end -}}
|
|
{{- with .PrevInSection -}}
|
|
<a href="{{ .RelPermalink }}" rel="next">
|
|
<small>Next →</small>
|
|
<span>{{ .LinkTitle }}</span>
|
|
</a>
|
|
{{- end -}}
|
|
</footer>
|
|
{{- end -}}
|
|
</article>
|
|
|
|
{{- with .TableOfContents -}}
|
|
<aside data-toc>
|
|
<small>On this page</small>
|
|
{{ . }}
|
|
</aside>
|
|
{{- end -}}
|
|
{{ end }}
|