summaryrefslogtreecommitdiffstats
path: root/layouts/partials
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-05 10:09:22 +0100
committerDanilo M. <danix@danix.xyz>2026-11-05 10:09:22 +0100
commit2cbd791c7a90b1e88718c4caab155c1ffe29619d (patch)
tree4fed10ad3629a4e12d60e74fb4357c0e3db4091b /layouts/partials
parent49635ab3e84106c189596a941f77eded2dd74449 (diff)
downloaddanixxyz-theme-2cbd791c7a90b1e88718c4caab155c1ffe29619d.tar.gz
danixxyz-theme-2cbd791c7a90b1e88718c4caab155c1ffe29619d.zip
feat: add layouts for the HardenedPass docs section
Sidebar with the page tree and table of contents, collapsing into native details elements on mobile, and prev/next links that follow one reading order across subsections. The section joins the search index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/docs-nav.html25
-rw-r--r--layouts/partials/docs-pager.html10
-rw-r--r--layouts/partials/docs-tree.html21
3 files changed, 56 insertions, 0 deletions
diff --git a/layouts/partials/docs-nav.html b/layouts/partials/docs-nav.html
new file mode 100644
index 0000000..80dc381
--- /dev/null
+++ b/layouts/partials/docs-nav.html
@@ -0,0 +1,25 @@
+{{/* The tree and table of contents render twice, so Hugo's id on the table of contents goes. */}}
+{{ $toc := replace .TableOfContents ` id="TableOfContents"` "" | safeHTML }}
+{{ $hasToc := gt (len .Fragments.Headings) 0 }}
+<div class="lg:hidden mb-8 space-y-2">
+ <details class="border border-border p-3">
+ <summary class="font-mono cursor-pointer">{{ i18n "docsMenu" }}</summary>
+ <div class="mt-3">{{ partial "docs-tree.html" . }}</div>
+ </details>
+ {{ if $hasToc }}
+ <details class="border border-border p-3">
+ <summary class="font-mono cursor-pointer">{{ i18n "docsOnThisPage" }}</summary>
+ <div class="mt-3 text-sm text-text-dim">{{ $toc }}</div>
+ </details>
+ {{ end }}
+</div>
+<aside class="hidden lg:block lg:sticky lg:top-24 lg:self-start lg:max-h-[calc(100vh-7rem)] lg:overflow-y-auto"
+ aria-label="{{ i18n "docsMenu" }}">
+ {{ partial "docs-tree.html" . }}
+ {{ if $hasToc }}
+ <div class="mt-8 border-t border-border pt-4 text-sm text-text-dim">
+ <p class="font-mono text-accent mb-2">{{ i18n "docsOnThisPage" }}</p>
+ {{ $toc }}
+ </div>
+ {{ end }}
+</aside>
diff --git a/layouts/partials/docs-pager.html b/layouts/partials/docs-pager.html
new file mode 100644
index 0000000..e44b570
--- /dev/null
+++ b/layouts/partials/docs-pager.html
@@ -0,0 +1,10 @@
+{{/* Pages.Next steps toward index 0, so reversing makes "next" the following page. */}}
+{{ $pages := (site.GetPage "/hardenedpass").RegularPagesRecursive.ByWeight.Reverse }}
+{{ $prev := $pages.Prev . }}
+{{ $next := $pages.Next . }}
+{{ if or $prev $next }}
+<nav class="flex justify-between gap-4 border-t border-border pt-6 font-mono text-sm" aria-label="{{ i18n "docsPager" }}">
+ <span>{{ with $prev }}<a href="{{ .RelPermalink }}" rel="prev" class="text-accent">◄ {{ .Title }}</a>{{ end }}</span>
+ <span class="text-right">{{ with $next }}<a href="{{ .RelPermalink }}" rel="next" class="text-accent">{{ .Title }} ►</a>{{ end }}</span>
+</nav>
+{{ end }}
diff --git a/layouts/partials/docs-tree.html b/layouts/partials/docs-tree.html
new file mode 100644
index 0000000..bdc1c07
--- /dev/null
+++ b/layouts/partials/docs-tree.html
@@ -0,0 +1,21 @@
+{{ $current := . }}
+{{ $root := site.GetPage "/hardenedpass" }}
+<ul class="space-y-4 text-sm">
+ <li><a href="{{ $root.RelPermalink }}" class="font-mono text-accent">{{ $root.Title }}</a></li>
+ {{ range $root.Sections.ByWeight }}
+ <li>
+ <a href="{{ .RelPermalink }}" class="font-mono text-accent">{{ .Title }}</a>
+ <ul class="mt-2 space-y-1 border-l border-border pl-3">
+ {{ range .RegularPages.ByWeight }}
+ <li>
+ {{ if $current.Eq . }}
+ <a href="{{ .RelPermalink }}" aria-current="page" class="text-accent font-bold">{{ .Title }}</a>
+ {{ else }}
+ <a href="{{ .RelPermalink }}" class="text-text-dim hover:text-accent">{{ .Title }}</a>
+ {{ end }}
+ </li>
+ {{ end }}
+ </ul>
+ </li>
+ {{ end }}
+</ul>