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).
40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
{{ define "header" }}
|
|
<header>
|
|
<h1>{{ .Title }}</h1>
|
|
{{ with .Description }}<p data-abstract>{{ . }}</p>{{ end }}
|
|
{{- $hasDate := not .Date.IsZero -}}
|
|
{{- $hasAuthor := .Params.author -}}
|
|
{{- if or $hasDate $hasAuthor -}}
|
|
<p data-byline>
|
|
{{- if $hasDate -}}
|
|
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time>
|
|
{{- end -}}
|
|
{{- if and $hasDate $hasAuthor }} · {{ end -}}
|
|
{{- with .Params.author }}{{ . }}{{ end -}}
|
|
</p>
|
|
{{- end }}
|
|
{{- with .GetTerms "tags" }}
|
|
<nav data-role="tag-cloud" aria-label="Tags">
|
|
{{- range . }}
|
|
<a href="{{ .Permalink }}" data-tag="{{ .Name }}">{{ .Name }}</a>
|
|
{{- end }}
|
|
</nav>
|
|
{{- end }}
|
|
</header>
|
|
{{ end }}
|
|
|
|
{{ define "content" }}
|
|
<article role="main">
|
|
{{ .Content }}
|
|
{{- if or .PrevInSection .NextInSection }}
|
|
<footer>
|
|
{{- with .PrevInSection }}
|
|
<a href="{{ .RelPermalink }}" rel="prev">← {{ .LinkTitle }}</a>
|
|
{{- end }}
|
|
{{- with .NextInSection }}
|
|
<a href="{{ .RelPermalink }}" rel="next">{{ .LinkTitle }} →</a>
|
|
{{- end }}
|
|
</footer>
|
|
{{- end }}
|
|
</article>
|
|
{{ end }}
|