drop <main>, use <article role="main"> — bold landmark structure

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).
This commit is contained in:
Vigilio Desto 2026-04-10 20:33:25 +02:00
parent 169374e2fd
commit c2261bfc9f
Signed by: vigilio
GPG key ID: 159D6AD58C8E55E9
7 changed files with 291 additions and 357 deletions

View file

@ -4,10 +4,9 @@
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
</head> </head>
<body> <body>
<header>
{{ partial "nav.html" . }} {{ partial "nav.html" . }}
</header> {{ block "header" . }}{{ end }}
{{ block "main" . }}{{ end }} {{ block "content" . }}{{ end }}
<footer> <footer>
<small><a href="/">{{ .Site.Title }}</a> · {{ now.Format "2006" }}</small> <small><a href="/">{{ .Site.Title }}</a> · {{ now.Format "2006" }}</small>
</footer> </footer>

View file

@ -1,12 +1,12 @@
{{ define "main" }} {{ define "header" }}
<main>
<article data-layout="prose">
<header> <header>
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{ with .Description }}<p>{{ . }}</p>{{ end }} {{ with .Description }}<p>{{ . }}</p>{{ end }}
</header> </header>
{{ end }}
{{ define "content" }}
<article role="main">
<section> <section>
{{ range .Pages }} {{ range .Pages }}
<article> <article>
@ -20,7 +20,5 @@
</article> </article>
{{ end }} {{ end }}
</section> </section>
</article> </article>
</main>
{{ end }} {{ end }}

View file

@ -1,7 +1,4 @@
{{ define "main" }} {{ define "header" }}
<main>
<article data-layout="prose">
<header> <header>
<hgroup> <hgroup>
{{ with .Params.eyebrow }}<p data-text="eyebrow">{{ . }}</p>{{ end }} {{ with .Params.eyebrow }}<p data-text="eyebrow">{{ . }}</p>{{ end }}
@ -9,17 +6,19 @@
{{ with .Description }}<p>{{ . }}</p>{{ end }} {{ with .Description }}<p>{{ . }}</p>{{ end }}
</hgroup> </hgroup>
<p data-text="dim"> <p data-text="dim">
<time datetime="{{ .Date.Format `2006-01-02` }}">{{ .Date.Format "January 2006" }}</time> <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2006" }}</time>
{{ with .Params.author }} · {{ . }}{{ end }} {{ with .Params.author }} · {{ . }}{{ end }}
</p> </p>
</header> </header>
{{ end }}
{{ .Content }}
{{ define "content" }}
<footer> <article role="main">
<small>{{ with .Params.footer }}{{ . }}{{ else }}Published in the dorveille.{{ end }}</small> {{ .Content }}
</footer> {{ with .Params.footer }}
<footer>
</article> <small>{{ . }}</small>
</main> </footer>
{{ end }}
</article>
{{ end }} {{ end }}

View file

@ -1,15 +1,21 @@
{{ define "main" }} {{ define "header" }}
<main> <header>
<div data-layout="docs"> {{- if .Description -}}
<hgroup>
<h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</hgroup>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end }}
</header>
{{ end }}
{{/* ── Left sidebar ─────────────────────────────────────────────── */}} {{ define "content" }}
{{/* Docs sidebar — this is navigation, not an aside */}}
<aside>
<nav aria-label="Documentation" data-nav="sidebar"> <nav aria-label="Documentation" data-nav="sidebar">
{{- $menu := index .Site.Menus "docs" -}} {{- $menu := index .Site.Menus "docs" -}}
{{- if $menu -}} {{- if $menu -}}
{{- range $menu -}} {{- range $menu -}}
{{- if .HasChildren -}} {{- if .HasChildren -}}
<small>{{ .Name }}</small> <small>{{ .Name }}</small>
@ -34,10 +40,7 @@
</ul> </ul>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{/* Fallback: list sibling pages in the docs section */}}
{{- with .CurrentSection -}} {{- with .CurrentSection -}}
<small>{{ .Title }}</small> <small>{{ .Title }}</small>
<ul> <ul>
@ -51,30 +54,14 @@
{{- end -}} {{- end -}}
</ul> </ul>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</nav> </nav>
</aside>
{{/* ── Main content ──────────────────────────────────────────────── */}}
<article>
{{- if .Description -}}
<hgroup>
<h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</hgroup>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end }}
<article role="main">
{{ .Content }} {{ .Content }}
{{- if or .PrevInSection .NextInSection -}} {{- if or .PrevInSection .NextInSection -}}
<div data-role="prev-next"> <footer data-role="prev-next">
{{- with .NextInSection -}} {{- with .NextInSection -}}
<a href="{{ .RelPermalink }}" rel="prev"> <a href="{{ .RelPermalink }}" rel="prev">
<small>← Previous</small> <small>← Previous</small>
@ -87,21 +74,14 @@
<span>{{ .LinkTitle }}</span> <span>{{ .LinkTitle }}</span>
</a> </a>
{{- end -}} {{- end -}}
</div> </footer>
{{- end -}} {{- end -}}
</article> </article>
{{/* ── Right TOC ────────────────────────────────────────────────── */}}
{{- with .TableOfContents -}} {{- with .TableOfContents -}}
<aside data-toc> <aside data-toc>
<small>On this page</small> <small>On this page</small>
{{ . }} {{ . }}
</aside> </aside>
{{- end -}} {{- end -}}
</div>
</main>
{{ end }} {{ end }}

View file

@ -1,16 +1,16 @@
{{ define "title" }}{{ .Site.Title }}{{ end }} {{ define "title" }}{{ .Site.Title }}{{ end }}
{{ define "main" }} {{ define "header" }}
<main>
<article data-layout="prose">
<header> <header>
<hgroup> <hgroup>
<h1>{{ .Site.Title }}</h1> <h1>{{ .Site.Title }}</h1>
<p>{{ .Site.Params.description | default "An agent-first approach to web generation." }}</p> <p>{{ .Site.Params.description | default "An agent-first approach to web generation." }}</p>
</hgroup> </hgroup>
</header> </header>
{{ end }}
{{ define "content" }}
<article role="main">
<section> <section>
<h2>Recent</h2> <h2>Recent</h2>
{{ range first 10 .Site.RegularPages }} {{ range first 10 .Site.RegularPages }}
@ -26,7 +26,5 @@
</article> </article>
{{ end }} {{ end }}
</section> </section>
</article> </article>
</main>
{{ end }} {{ end }}

View file

@ -1,16 +1,7 @@
{{ define "main" }} {{ define "header" }}
<main>
<article data-paper>
<header> <header>
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
{{ with .Description }}<p data-abstract>{{ . }}</p>{{ end }}
{{- with .Description -}}
<p data-abstract>{{ . }}</p>
{{- end -}}
{{/* Byline: date and/or author */}}
{{- $hasDate := not .Date.IsZero -}} {{- $hasDate := not .Date.IsZero -}}
{{- $hasAuthor := .Params.author -}} {{- $hasAuthor := .Params.author -}}
{{- if or $hasDate $hasAuthor -}} {{- if or $hasDate $hasAuthor -}}
@ -18,42 +9,32 @@
{{- if $hasDate -}} {{- if $hasDate -}}
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time> <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time>
{{- end -}} {{- end -}}
{{- if and $hasDate $hasAuthor -}} {{- if and $hasDate $hasAuthor }} · {{ end -}}
<span aria-hidden="true"> · </span> {{- with .Params.author }}{{ . }}{{ end -}}
{{- end -}}
{{- with .Params.author -}}
<span>{{ . }}</span>
{{- end -}}
</p> </p>
{{- end -}} {{- end }}
{{- with .GetTerms "tags" }}
{{/* Tags */}}
{{- with .GetTerms "tags" -}}
<nav data-role="tag-cloud" aria-label="Tags"> <nav data-role="tag-cloud" aria-label="Tags">
{{- range . -}} {{- range . }}
<a href="{{ .Permalink }}" data-tag="{{ .Name }}">{{ .Name }}</a> <a href="{{ .Permalink }}" data-tag="{{ .Name }}">{{ .Name }}</a>
{{- end -}} {{- end }}
</nav> </nav>
{{- end -}} {{- end }}
</header> </header>
{{ end }}
{{ .Content }} {{ define "content" }}
<article role="main">
{{ .Content }}
{{/* ── Prev / Next footer ──────────────────────────────────────── */}} {{- if or .PrevInSection .NextInSection }}
{{- if or .PrevInSection .NextInSection -}} <footer>
<footer> {{- with .PrevInSection }}
{{- with .PrevInSection -}} <a href="{{ .RelPermalink }}" rel="prev">← {{ .LinkTitle }}</a>
<a href="{{ .RelPermalink }}" rel="prev">← {{ .LinkTitle }}</a> {{- end }}
{{- end -}} {{- with .NextInSection }}
{{- with .NextInSection -}} <a href="{{ .RelPermalink }}" rel="next">{{ .LinkTitle }} →</a>
<a href="{{ .RelPermalink }}" rel="next">{{ .LinkTitle }} →</a> {{- end }}
{{- end -}} </footer>
</footer> {{- end }}
{{- end -}} </article>
</article>
</main>
{{ end }} {{ end }}

View file

@ -1,16 +1,22 @@
{{ define "main" }} {{ define "header" }}
<main> <header>
<div data-layout="docs"> {{- if .Description -}}
<hgroup>
<h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</hgroup>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end }}
</header>
{{ end }}
{{/* ── Left sidebar ─────────────────────────────────────────────── */}} {{ define "content" }}
{{/* Vault sidebar navigation */}}
<aside> <nav aria-label="Vault" data-nav="sidebar">
{{- $menuName := .Site.Params.vault_menu | default "vault" -}} {{- $menuName := .Site.Params.vault_menu | default "vault" -}}
<nav aria-label="Vault documentation" data-nav="sidebar">
{{- $menu := index .Site.Menus $menuName -}} {{- $menu := index .Site.Menus $menuName -}}
{{- if $menu -}} {{- if $menu -}}
{{- range $menu -}} {{- range $menu -}}
{{- if .HasChildren -}} {{- if .HasChildren -}}
<small>{{ .Name }}</small> <small>{{ .Name }}</small>
@ -35,10 +41,7 @@
</ul> </ul>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{/* Fallback: list direct pages of the current section */}}
{{- with .CurrentSection -}} {{- with .CurrentSection -}}
<small>{{ .Title }}</small> <small>{{ .Title }}</small>
<ul> <ul>
@ -52,35 +55,18 @@
{{- end -}} {{- end -}}
</ul> </ul>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</nav> </nav>
</aside>
{{/* ── Main content ──────────────────────────────────────────────── */}}
<article>
{{- if .Description -}}
<hgroup>
<h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</hgroup>
{{- else -}}
<h1>{{ .Title }}</h1>
{{- end }}
<article role="main">
{{ .Content }} {{ .Content }}
{{/* ── Prev / Next — from front matter, not Hugo section order ── */}}
{{- $prevURL := index .Params "prev-url" -}} {{- $prevURL := index .Params "prev-url" -}}
{{- $prevTitle := index .Params "prev-title" -}} {{- $prevTitle := index .Params "prev-title" -}}
{{- $nextURL := index .Params "next-url" -}} {{- $nextURL := index .Params "next-url" -}}
{{- $nextTitle := index .Params "next-title" -}} {{- $nextTitle := index .Params "next-title" -}}
{{- if or $prevURL $nextURL -}} {{- if or $prevURL $nextURL -}}
<div data-role="prev-next"> <footer data-role="prev-next">
{{- if $prevURL -}} {{- if $prevURL -}}
<a href="{{ $prevURL }}" rel="prev"> <a href="{{ $prevURL }}" rel="prev">
<small>← Previous</small> <small>← Previous</small>
@ -93,21 +79,14 @@
<span>{{ $nextTitle }}</span> <span>{{ $nextTitle }}</span>
</a> </a>
{{- end -}} {{- end -}}
</div> </footer>
{{- end -}} {{- end -}}
</article> </article>
{{/* ── Right TOC ────────────────────────────────────────────────── */}}
{{- with .TableOfContents -}} {{- with .TableOfContents -}}
<aside data-toc> <aside data-toc>
<small>On this page</small> <small>On this page</small>
{{ . }} {{ . }}
</aside> </aside>
{{- end -}} {{- end -}}
</div>
</main>
{{ end }} {{ end }}