finish the reference theme, and the contract holes it found
The theme was supposed to need no engine work. It needed four things, which is exactly what the audit said would happen if the contract had gaps rather than the theme (ADR-0046) — a reader could not reach, from any page: another section, the tags on the page they were reading, the extras beside it, or the same page in another language. So the contract grew three fields, all additive: `.Sections` for navigation, `.Tags` with each term's listing URL, and `.ExtrasURL`, empty when a bundle has none so a theme never links a 404. Sections arrive through `Renderer.Navigation`, a callback, because sections change when content does and a copy would go stale — the nav updates on a rebuild along with everything else. One flaw only visible by looking at a rendered page: the language switcher pointed at the canonical host, because `.Alternates` went absolute for hreflang. Those are two needs, so an Alternate now carries `.URL` (absolute, for machines) and `.Path` (relative, for a link a person clicks). The theme now demonstrates every field it is given, including `.First`/`.Last`, which existed and were never rendered. Still no JavaScript, still one stylesheet. A test that asserted a page had no sequence nav was matching the inlined stylesheet rather than the markup, and now matches the element. That is the third time a loose assertion has passed for the wrong reason.
This commit is contained in:
@@ -10,6 +10,12 @@
|
||||
<span><a href="{{.URL}}">{{if .Title}}{{.Title}}{{else}}{{.URL}}{{end}}</a> {{t $.Lang "position" (num $.Lang .Index) (num $.Lang .Count)}}</span>
|
||||
{{- with .Next}}<a rel="next" href="{{.URL}}">{{if .Title}}{{.Title}}{{else}}{{.Key}}{{end}}</a>{{end}}
|
||||
</nav>
|
||||
{{- if gt .Count 2}}
|
||||
<nav class="ends">
|
||||
{{- with .First}}<a href="{{.URL}}">{{t $.Lang "first"}}</a>{{end}}
|
||||
{{- with .Last}}<a href="{{.URL}}">{{t $.Lang "last"}}</a>{{end}}
|
||||
</nav>
|
||||
{{- end}}
|
||||
{{- else if .Members}}
|
||||
<nav class="sequence">
|
||||
<ol class="archive">
|
||||
@@ -21,4 +27,18 @@
|
||||
</nav>
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{- if or .Tags .ExtrasURL}}
|
||||
<footer class="about-this-page">
|
||||
{{- if .Tags}}
|
||||
<nav class="tags">
|
||||
{{- range .Tags}}
|
||||
<a rel="tag" href="{{.URL}}">{{.Title}}</a>
|
||||
{{- end}}
|
||||
</nav>
|
||||
{{- end}}
|
||||
{{- if .ExtrasURL}}
|
||||
<p><a href="{{.ExtrasURL}}">{{t .Lang "extras"}}</a></p>
|
||||
{{- end}}
|
||||
</footer>
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
||||
Reference in New Issue
Block a user