From a1ebb1c85ae6d749170ce4e9b18f0bdec92d27e8 Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 28 Jun 2025 11:20:24 -0700 Subject: bare --- layouts/_partials/footer.html | 1 + layouts/_partials/head.html | 5 ++++ layouts/_partials/head/css.html | 9 ++++++++ layouts/_partials/head/js.html | 16 +++++++++++++ layouts/_partials/header.html | 2 ++ layouts/_partials/menu.html | 51 +++++++++++++++++++++++++++++++++++++++++ layouts/_partials/terms.html | 23 +++++++++++++++++++ layouts/baseof.html | 17 ++++++++++++++ layouts/home.html | 7 ++++++ layouts/page.html | 10 ++++++++ layouts/section.html | 8 +++++++ layouts/taxonomy.html | 7 ++++++ layouts/term.html | 7 ++++++ 13 files changed, 163 insertions(+) create mode 100644 layouts/_partials/footer.html create mode 100644 layouts/_partials/head.html create mode 100644 layouts/_partials/head/css.html create mode 100644 layouts/_partials/head/js.html create mode 100644 layouts/_partials/header.html create mode 100644 layouts/_partials/menu.html create mode 100644 layouts/_partials/terms.html create mode 100644 layouts/baseof.html create mode 100644 layouts/home.html create mode 100644 layouts/page.html create mode 100644 layouts/section.html create mode 100644 layouts/taxonomy.html create mode 100644 layouts/term.html (limited to 'layouts') diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html new file mode 100644 index 0000000..a7cd916 --- /dev/null +++ b/layouts/_partials/footer.html @@ -0,0 +1 @@ +

Copyright {{ now.Year }}. All rights reserved.

diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html new file mode 100644 index 0000000..02c2240 --- /dev/null +++ b/layouts/_partials/head.html @@ -0,0 +1,5 @@ + + +{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }} +{{ partialCached "head/css.html" . }} +{{ partialCached "head/js.html" . }} diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html new file mode 100644 index 0000000..d76d23a --- /dev/null +++ b/layouts/_partials/head/css.html @@ -0,0 +1,9 @@ +{{- with resources.Get "css/main.css" }} + {{- if hugo.IsDevelopment }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} diff --git a/layouts/_partials/head/js.html b/layouts/_partials/head/js.html new file mode 100644 index 0000000..16ffbed --- /dev/null +++ b/layouts/_partials/head/js.html @@ -0,0 +1,16 @@ +{{- with resources.Get "js/main.js" }} + {{- $opts := dict + "minify" (not hugo.IsDevelopment) + "sourceMap" (cond hugo.IsDevelopment "external" "") + "targetPath" "js/main.js" + }} + {{- with . | js.Build $opts }} + {{- if hugo.IsDevelopment }} + + {{- else }} + {{- with . | fingerprint }} + + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html new file mode 100644 index 0000000..7980a00 --- /dev/null +++ b/layouts/_partials/header.html @@ -0,0 +1,2 @@ +

{{ site.Title }}

+{{ partial "menu.html" (dict "menuID" "main" "page" .) }} diff --git a/layouts/_partials/menu.html b/layouts/_partials/menu.html new file mode 100644 index 0000000..14245b5 --- /dev/null +++ b/layouts/_partials/menu.html @@ -0,0 +1,51 @@ +{{- /* +Renders a menu for the given menu ID. + +@context {page} page The current page. +@context {string} menuID The menu ID. + +@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }} +*/}} + +{{- $page := .page }} +{{- $menuID := .menuID }} + +{{- with index site.Menus $menuID }} + +{{- end }} + +{{- define "_partials/inline/menu/walk.html" }} + {{- $page := .page }} + {{- range .menuEntries }} + {{- $attrs := dict "href" .URL }} + {{- if $page.IsMenuCurrent .Menu . }} + {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} + {{- else if $page.HasMenuCurrent .Menu .}} + {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} + {{- end }} + {{- $name := .Name }} + {{- with .Identifier }} + {{- with T . }} + {{- $name = . }} + {{- end }} + {{- end }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • + {{- end }} +{{- end }} diff --git a/layouts/_partials/terms.html b/layouts/_partials/terms.html new file mode 100644 index 0000000..8a6ebec --- /dev/null +++ b/layouts/_partials/terms.html @@ -0,0 +1,23 @@ +{{- /* +For a given taxonomy, renders a list of terms assigned to the page. + +@context {page} page The current page. +@context {string} taxonomy The taxonomy. + +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +*/}} + +{{- $page := .page }} +{{- $taxonomy := .taxonomy }} + +{{- with $page.GetTerms $taxonomy }} + {{- $label := (index . 0).Parent.LinkTitle }} +
    +
    {{ $label }}:
    + +
    +{{- end }} diff --git a/layouts/baseof.html b/layouts/baseof.html new file mode 100644 index 0000000..39dcbec --- /dev/null +++ b/layouts/baseof.html @@ -0,0 +1,17 @@ + + + + {{ partial "head.html" . }} + + +
    + {{ partial "header.html" . }} +
    +
    + {{ block "main" . }}{{ end }} +
    + + + diff --git a/layouts/home.html b/layouts/home.html new file mode 100644 index 0000000..0df6597 --- /dev/null +++ b/layouts/home.html @@ -0,0 +1,7 @@ +{{ define "main" }} + {{ .Content }} + {{ range site.RegularPages }} +

    {{ .LinkTitle }}

    + {{ .Summary }} + {{ end }} +{{ end }} diff --git a/layouts/page.html b/layouts/page.html new file mode 100644 index 0000000..7e286c8 --- /dev/null +++ b/layouts/page.html @@ -0,0 +1,10 @@ +{{ define "main" }} +

    {{ .Title }}

    + + {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} + {{ $dateHuman := .Date | time.Format ":date_long" }} + + + {{ .Content }} + {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +{{ end }} diff --git a/layouts/section.html b/layouts/section.html new file mode 100644 index 0000000..50fc92d --- /dev/null +++ b/layouts/section.html @@ -0,0 +1,8 @@ +{{ define "main" }} +

    {{ .Title }}

    + {{ .Content }} + {{ range .Pages }} +

    {{ .LinkTitle }}

    + {{ .Summary }} + {{ end }} +{{ end }} diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html new file mode 100644 index 0000000..c2e7875 --- /dev/null +++ b/layouts/taxonomy.html @@ -0,0 +1,7 @@ +{{ define "main" }} +

    {{ .Title }}

    + {{ .Content }} + {{ range .Pages }} +

    {{ .LinkTitle }}

    + {{ end }} +{{ end }} diff --git a/layouts/term.html b/layouts/term.html new file mode 100644 index 0000000..c2e7875 --- /dev/null +++ b/layouts/term.html @@ -0,0 +1,7 @@ +{{ define "main" }} +

    {{ .Title }}

    + {{ .Content }} + {{ range .Pages }} +

    {{ .LinkTitle }}

    + {{ end }} +{{ end }} -- cgit v1.2.3