summaryrefslogtreecommitdiff
path: root/layouts/partials
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/document-view.html19
-rw-r--r--layouts/partials/footer.html11
-rw-r--r--layouts/partials/header.html7
-rw-r--r--layouts/partials/primary-nav.html8
-rw-r--r--layouts/partials/recent.html23
-rw-r--r--layouts/partials/series-nav.html35
-rw-r--r--layouts/partials/toc.html7
7 files changed, 110 insertions, 0 deletions
diff --git a/layouts/partials/document-view.html b/layouts/partials/document-view.html
new file mode 100644
index 0000000..5bfc7b6
--- /dev/null
+++ b/layouts/partials/document-view.html
@@ -0,0 +1,19 @@
+{{- if .File -}}
+ {{- $rawURL := "" -}}
+ {{- if .IsPage -}}
+ {{- $htmlBase := strings.TrimSuffix ".html" .RelPermalink -}}
+ {{- $rawURL = printf "%s/index.md" $htmlBase -}}
+ {{- else if .IsSection -}}
+ {{- $rawURL = printf "%s_index.md" .RelPermalink -}}
+ {{- end -}}
+ {{- $gitBase := strings.TrimSuffix "/" site.Params.gitBase -}}
+ {{- $gitURL := printf "%s/content/%s" $gitBase .File.Path -}}
+ <nav class="document-view" aria-label="Document formats">
+ <span>view:</span>
+ <a href="{{ .RelPermalink }}" aria-current="page">html</a>
+ <span aria-hidden="true">·</span>
+ <a href="{{ $rawURL }}">raw .md</a>
+ <span aria-hidden="true">·</span>
+ <a href="{{ $gitURL }}">git</a>
+ </nav>
+{{- end -}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
new file mode 100644
index 0000000..ac89098
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1,11 @@
+<footer class="site-footer">
+ <nav aria-label="Site information">
+ <a href="{{ "/rss.xml" | relURL }}">rss</a>
+ <span aria-hidden="true">·</span>
+ <a href="{{ site.Params.sourceURL }}">source</a>
+ <span aria-hidden="true">·</span>
+ <a href="mailto:{{ site.Params.email }}">email</a>
+ </nav>
+ <p>Code: GPL-3.0-or-later<br>Content: {{ site.Params.contentLicense }}</p>
+ <p>No JavaScript <span aria-hidden="true">·</span> No Cookies <span aria-hidden="true">·</span> No Tracking<br>Best viewed with any browser.</p>
+</footer>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..813713f
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,7 @@
+<header class="site-header">
+ <a class="skip-link" href="#main-content">Skip to content</a>
+ <a class="site-identity" href="{{ "/" | relURL }}">{{ site.Params.identity }}</a>
+ {{- if not .IsHome }}
+ {{ partial "primary-nav.html" . }}
+ {{- end }}
+</header>
diff --git a/layouts/partials/primary-nav.html b/layouts/partials/primary-nav.html
new file mode 100644
index 0000000..8be0124
--- /dev/null
+++ b/layouts/partials/primary-nav.html
@@ -0,0 +1,8 @@
+<nav class="site-nav" aria-label="Primary">
+ <a href="{{ "/journal/" | relURL }}"{{ if eq .Section "journal" }} aria-current="page"{{ end }}>journal/</a>
+ <a href="{{ "/notes/" | relURL }}"{{ if eq .Section "notes" }} aria-current="page"{{ end }}>notes/</a>
+ <a href="{{ "/projects/" | relURL }}"{{ if eq .Section "projects" }} aria-current="page"{{ end }}>projects/</a>
+ <a href="{{ "/links/" | relURL }}"{{ if eq .Section "links" }} aria-current="page"{{ end }}>links/</a>
+ <a href="{{ "/about.txt" | relURL }}">about.txt</a>
+ <a href="{{ "/now.txt" | relURL }}">now.txt</a>
+</nav>
diff --git a/layouts/partials/recent.html b/layouts/partials/recent.html
new file mode 100644
index 0000000..47c8332
--- /dev/null
+++ b/layouts/partials/recent.html
@@ -0,0 +1,23 @@
+{{- $items := slice -}}
+{{- range where site.RegularPages "Section" "journal" -}}
+ {{- $items = $items | append (dict "page" . "kind" "journal" "sortDate" (.Date.Format "2006-01-02")) -}}
+{{- end -}}
+{{- range where site.RegularPages "Section" "notes" -}}
+ {{- $page := . -}}
+ {{- with $page.Params.recent -}}
+ {{- $items = $items | append (dict "page" $page "kind" "note" "sortDate" (time.Format "2006-01-02" .)) -}}
+ {{- end -}}
+{{- end -}}
+{{- $items = sort $items "sortDate" "desc" -}}
+<section class="recent" aria-labelledby="recent-title">
+ <h2 id="recent-title">RECENT</h2>
+ <ol class="document-list">
+ {{- range $items }}
+ <li>
+ <time datetime="{{ .sortDate }}">{{ .sortDate }}</time>
+ <span class="document-kind">[{{ .kind }}]</span>
+ <a href="{{ .page.RelPermalink }}" lang="{{ .page.Params.lang }}">{{ .page.LinkTitle }}</a>
+ </li>
+ {{- end }}
+ </ol>
+</section>
diff --git a/layouts/partials/series-nav.html b/layouts/partials/series-nav.html
new file mode 100644
index 0000000..c88055c
--- /dev/null
+++ b/layouts/partials/series-nav.html
@@ -0,0 +1,35 @@
+{{- $page := .page -}}
+{{- $mode := .mode -}}
+{{- $pages := where $page.CurrentSection.RegularPages.ByWeight "Params.series" $page.Params.series -}}
+{{- $currentIndex := -1 -}}
+{{- range $index, $candidate := $pages -}}
+ {{- if eq $candidate.RelPermalink $page.RelPermalink -}}
+ {{- $currentIndex = $index -}}
+ {{- end -}}
+{{- end -}}
+{{- if ge $currentIndex 0 -}}
+ {{- $position := add $currentIndex 1 -}}
+ {{- if eq $mode "position" }}
+ <p class="series-position"><a href="{{ $page.CurrentSection.RelPermalink }}">{{ $page.CurrentSection.LinkTitle }}</a> <span aria-hidden="true">·</span> {{ printf "%02d/%d" $position (len $pages) }}</p>
+ {{- else if eq $mode "navigation" }}
+ <nav class="document-navigation series-navigation" aria-label="{{ $page.CurrentSection.LinkTitle }} chapters">
+ <ul>
+ <li class="series-previous"{{ if eq $currentIndex 0 }} aria-hidden="true"{{ end }}>
+ {{- if gt $currentIndex 0 }}
+ {{- $previous := index $pages (sub $currentIndex 1) }}
+ <span class="navigation-label">previous</span>
+ <a rel="prev" href="{{ $previous.RelPermalink }}">← {{ printf "%02d. %s" (sub $position 1) $previous.LinkTitle }}</a>
+ {{- end }}
+ </li>
+ <li class="series-index-link"><a href="{{ $page.CurrentSection.RelPermalink }}">↑ {{ $page.CurrentSection.LinkTitle }}</a></li>
+ <li class="series-next"{{ if eq $position (len $pages) }} aria-hidden="true"{{ end }}>
+ {{- if lt $position (len $pages) }}
+ {{- $next := index $pages $position }}
+ <span class="navigation-label">next</span>
+ <a rel="next" href="{{ $next.RelPermalink }}">{{ printf "%02d. %s" (add $position 1) $next.LinkTitle }} →</a>
+ {{- end }}
+ </li>
+ </ul>
+ </nav>
+ {{- end -}}
+{{- end -}}
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..4db9a6f
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,7 @@
+{{- $headings := findRE `<h[23][ >]` .Content -}}
+{{- if gt (len $headings) 4 }}
+ <section class="table-of-contents" aria-labelledby="contents-title">
+ <h2 id="contents-title">CONTENTS</h2>
+ {{ .TableOfContents }}
+ </section>
+{{- end -}}