`nav "docs-nav" .` reads a tree from a data file and places the page in it: entries are page source files, headings over more entries (with a page of their own or not, as deep as needed), or links elsewhere. It gives the page's trail of headings and its previous and next pages in reading order, a heading's page before what's under it, as MkDocs does. Entries whose page isn't in the build are left out. The docs pack's first format (parts and page names) reads as a tree. `path:` on a collection puts its pages elsewhere: `path: /` sits a docs site's pages at the root of its own host, so docs moved from MkDocs keep their addresses. Links to source files follow the move. Search indexes, feeds and calendars stay at /<collection>/ where scripts and the endpoint look for them. The docs pack (1.3.0) draws everything from the tree: a sidebar whose headings fold away (no script: <details>) with the part being read open, a breadcrumb, a page per heading listing what's under it, and previous and next links that now pass through a part's own page.
15 lines
665 B
HTML
15 lines
665 B
HTML
{{ define "main" }}
|
||
<link rel="stylesheet" href="{{ asset "packs/docs/docs.css" }}">
|
||
<div class="wrap docs{{ if gt (len (headings .Content)) 1 }} has-onpage{{ end }}">
|
||
{{ template "docs-sidebar" . }}
|
||
<article class="doc">
|
||
{{ with (nav "docs-nav" .).Trail }}<p class="crumb">{{ range $i, $t := . }}{{ if $i }} › {{ end }}{{ if .Page }}<a href="{{ .URL }}">{{ .Title }}</a>{{ else }}{{ .Title }}{{ end }}{{ end }}</p>{{ end }}
|
||
<h1>{{ .Title }}</h1>
|
||
{{ with .Summary }}<p class="lead">{{ . }}</p>{{ end }}
|
||
<div class="prose">{{ .Content }}</div>
|
||
{{ template "docs-prevnext" . }}
|
||
</article>
|
||
{{ template "docs-onpage" . }}
|
||
</div>
|
||
{{ end }}
|