diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
| -rw-r--r-- | layouts/hardenedpass/list.html | 22 | ||||
| -rw-r--r-- | layouts/hardenedpass/single.html | 15 | ||||
| -rw-r--r-- | layouts/index.json | 3 | ||||
| -rw-r--r-- | layouts/partials/docs-nav.html | 25 | ||||
| -rw-r--r-- | layouts/partials/docs-pager.html | 10 | ||||
| -rw-r--r-- | layouts/partials/docs-tree.html | 21 | ||||
| -rw-r--r-- | layouts/partials/hamburger-menu.html | 2 | ||||
| -rw-r--r-- | layouts/partials/header.html | 2 |
9 files changed, 99 insertions, 3 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 50bdf39..7aa13cc 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -111,6 +111,8 @@ {{ if eq .Kind "page" }} {{ $codeScript := resources.Get "js/code-copy.js" | minify }} <script src="{{ $codeScript.RelPermalink }}"></script> + {{ $zoomScript := resources.Get "js/image-zoom.js" | minify }} + <script src="{{ $zoomScript.RelPermalink }}"></script> {{ end }} <!-- Twemoji: consistent cross-platform emoji rendering on article pages --> diff --git a/layouts/hardenedpass/list.html b/layouts/hardenedpass/list.html new file mode 100644 index 0000000..0be5731 --- /dev/null +++ b/layouts/hardenedpass/list.html @@ -0,0 +1,22 @@ +{{ define "main" }} +<section class="mx-auto px-4 py-12 max-w-7xl"> + <div class="content-grid lg:grid lg:grid-cols-[16rem_minmax(0,1fr)] lg:gap-10"> + {{ partial "docs-nav.html" . }} + <div class="min-w-0"> + {{ partial "breadcrumb.html" . }} + <h1 class="text-4xl md:text-5xl font-bold mb-8 text-accent font-oxanium">{{ .Title }}</h1> + {{ with .Content }} + <div class="prose dark:prose-invert max-w-none mb-12">{{ . }}</div> + {{ end }} + <ul class="space-y-6"> + {{ range .Pages.ByWeight }} + <li> + <a href="{{ .RelPermalink }}" class="text-xl text-accent font-oxanium">{{ .Title }}</a> + {{ with .Description }}<p class="text-text-dim">{{ . }}</p>{{ end }} + </li> + {{ end }} + </ul> + </div> + </div> +</section> +{{ end }} diff --git a/layouts/hardenedpass/single.html b/layouts/hardenedpass/single.html new file mode 100644 index 0000000..123070f --- /dev/null +++ b/layouts/hardenedpass/single.html @@ -0,0 +1,15 @@ +{{ define "main" }} +<article class="mx-auto px-4 py-12 max-w-7xl"> + <div class="content-grid lg:grid lg:grid-cols-[16rem_minmax(0,1fr)] lg:gap-10"> + {{ partial "docs-nav.html" . }} + <div class="min-w-0"> + {{ partial "breadcrumb.html" . }} + <h1 class="text-4xl md:text-5xl font-bold mb-8 text-accent font-oxanium">{{ .Title }}</h1> + <div class="prose dark:prose-invert max-w-none mb-12"> + {{ .Content }} + </div> + {{ partial "docs-pager.html" . }} + </div> + </div> +</article> +{{ end }} diff --git a/layouts/index.json b/layouts/index.json index 891641a..778d1ba 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -1,6 +1,7 @@ {{- $articles := where .Site.RegularPages "Section" "articles" -}} {{- $projects := where .Site.RegularPages "Section" "slackware" -}} -{{- $articles = ($articles | append $projects).ByDate.Reverse -}} +{{- $docs := where .Site.RegularPages "Section" "hardenedpass" -}} +{{- $articles = ($articles | append $projects | append $docs).ByDate.Reverse -}} [ {{- range $index, $article := $articles -}} { 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> diff --git a/layouts/partials/hamburger-menu.html b/layouts/partials/hamburger-menu.html index e8b614b..d2a070f 100644 --- a/layouts/partials/hamburger-menu.html +++ b/layouts/partials/hamburger-menu.html @@ -39,7 +39,7 @@ {{ if $isActive }}aria-current="page"{{ end }} {{ if $isExternal }}target="_blank" rel="noopener noreferrer"{{ end }} > - {{ if $isExternal }}{{ .Name }}{{ else }}{{ i18n .Name }}{{ end }} + {{ if $isExternal }}{{ .Name }}<i data-feather="external-link" class="inline-block w-4 h-4 ml-1.5 align-middle" aria-hidden="true"></i>{{ else }}{{ i18n .Name }}{{ end }} {{ if $isExternal }}<span class="sr-only">{{ i18n "opensInNewTab" }}</span>{{ end }} </a> {{ if .HasChildren }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 050f27f..9810096 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -37,7 +37,7 @@ {{ if $isActive }}aria-current="page"{{ end }} {{ if $isExternal }}target="_blank" rel="noopener noreferrer"{{ end }} > - {{ if $isExternal }}{{ .Name }}{{ else }}{{ i18n .Name }}{{ end }} + {{ if $isExternal }}{{ .Name }}<i data-feather="external-link" class="inline-block w-3.5 h-3.5 ml-1 align-middle" aria-hidden="true"></i>{{ else }}{{ i18n .Name }}{{ end }} </a> {{ end }} {{ end }} |
