From a3c335a9a90a153a88790e187d0e761e067cd797 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sun, 19 Mar 2023 16:45:35 -0700 Subject: [PATCH] Add nested sections --- README.md | 10 ++++ exampleSite/content/authors/_index.md | 4 ++ exampleSite/content/categories/_index.md | 4 ++ exampleSite/content/search.md | 1 + exampleSite/content/series/_index.md | 4 ++ exampleSite/content/tags/_index.md | 4 ++ .../layouts/partials/paige/style-first.css | 14 +++--- i18n/de.yaml | 9 ++++ i18n/en.yaml | 9 ++++ layouts/partials/paige/subpages.html | 47 +++++++++++++++++-- 10 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 exampleSite/content/authors/_index.md create mode 100644 exampleSite/content/categories/_index.md create mode 100644 exampleSite/content/series/_index.md create mode 100644 exampleSite/content/tags/_index.md diff --git a/README.md b/README.md index 8200f55b..9f2b684f 100644 --- a/README.md +++ b/README.md @@ -755,6 +755,10 @@ Page identifiers:
The article.
#paige-authors
The authors.
+
#paige-collections
+
The collections.
+
#paige-collections-header
+
The collections header.
#paige-comments
The comments.
#paige-content
@@ -783,10 +787,16 @@ Page identifiers:
The reading time.
#paige-root
The outermost element in the body.
+
#paige-sections
+
The sections.
+
#paige-sections-header
+
The sections header.
#paige-series
The series.
#paige-subpages
The sub-pages.
+
#paige-subpages-header
+
The sub-pages header.
#paige-title
The title.
#paige-toc
diff --git a/exampleSite/content/authors/_index.md b/exampleSite/content/authors/_index.md new file mode 100644 index 00000000..96629f00 --- /dev/null +++ b/exampleSite/content/authors/_index.md @@ -0,0 +1,4 @@ +--- +description: "Browse by author." +title: "Authors" +--- diff --git a/exampleSite/content/categories/_index.md b/exampleSite/content/categories/_index.md new file mode 100644 index 00000000..a49707d5 --- /dev/null +++ b/exampleSite/content/categories/_index.md @@ -0,0 +1,4 @@ +--- +description: "Browse by category." +title: "Categories" +--- diff --git a/exampleSite/content/search.md b/exampleSite/content/search.md index 8ebabec8..11ce4b80 100644 --- a/exampleSite/content/search.md +++ b/exampleSite/content/search.md @@ -1,4 +1,5 @@ --- +description: "Search the site." layout: "paige/search" title: "Search" --- diff --git a/exampleSite/content/series/_index.md b/exampleSite/content/series/_index.md new file mode 100644 index 00000000..9f7b6e7c --- /dev/null +++ b/exampleSite/content/series/_index.md @@ -0,0 +1,4 @@ +--- +description: "Browse by series." +title: "Series" +--- diff --git a/exampleSite/content/tags/_index.md b/exampleSite/content/tags/_index.md new file mode 100644 index 00000000..ba6187e6 --- /dev/null +++ b/exampleSite/content/tags/_index.md @@ -0,0 +1,4 @@ +--- +description: "Browse by tag." +title: "Tags" +--- diff --git a/exampleSite/layouts/partials/paige/style-first.css b/exampleSite/layouts/partials/paige/style-first.css index eb38f94f..8cfdc074 100644 --- a/exampleSite/layouts/partials/paige/style-first.css +++ b/exampleSite/layouts/partials/paige/style-first.css @@ -5,12 +5,12 @@ #paige-reading-time, #paige-series, #paige-toc, -#paige-subpages .paige-authors, -#paige-subpages .paige-date, -#paige-subpages .paige-date-header, -#paige-subpages .paige-keywords, -#paige-subpages .paige-reading-time, -#paige-subpages .paige-series, -#paige-subpages .paige-summary { +.paige-authors, +.paige-date, +.paige-date-header, +.paige-keywords, +.paige-reading-time, +.paige-series, +.paige-summary { display: none; } diff --git a/i18n/de.yaml b/i18n/de.yaml index 4649c0c8..bf9f3263 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -1,3 +1,6 @@ +paige_collections: + other: Sammlungen + paige_figure: other: Abbildung @@ -14,6 +17,9 @@ paige_minutes: paige_noscript: other: JavaScript wird benötigt. +paige_pages: + other: Seiten + paige_search_button: other: Suche @@ -31,3 +37,6 @@ paige_search_searching: paige_search_something: other: Die Suche lieferte einige Treffer + +paige_sections: + other: Abschnitte diff --git a/i18n/en.yaml b/i18n/en.yaml index 434d7c50..aecf59f7 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,3 +1,6 @@ +paige_collections: + other: Collections + paige_figure: other: Figure @@ -14,6 +17,9 @@ paige_minutes: paige_noscript: other: JavaScript is required. +paige_pages: + other: Pages + paige_search_button: other: Search @@ -31,3 +37,6 @@ paige_search_searching: paige_search_something: other: Something found + +paige_sections: + other: Sections diff --git a/layouts/partials/paige/subpages.html b/layouts/partials/paige/subpages.html index 35c51def..78de21c0 100644 --- a/layouts/partials/paige/subpages.html +++ b/layouts/partials/paige/subpages.html @@ -1,9 +1,41 @@ {{ $page := . }} -{{ if $page.Pages }} +{{ $collections := cond $page.IsHome site.Taxonomies slice }} +{{ $sections := where $page.Pages "Kind" "section" }} +{{ $pages := where $page.Pages "Kind" "in" (slice "page" "term") }} + +{{ with $collections }} +
+ {{ if or $sections $pages }} +

{{ i18n "paige_collections" }}

+ {{ end }} + + {{ range $k, $v := . }} + {{ partial "paige/subpage.html" (site.GetPage $k) }} + {{ end }} +
+{{ end }} + +{{ with $sections }} +
+ {{ if or $collections $pages }} +

{{ i18n "paige_sections" }}

+ {{ end }} + + {{ range . }} + {{ partial "paige/subpage.html" . }} + {{ end }} +
+{{ end }} + +{{ with $pages }} {{ if $page.Param "paige.section_pages.full_pages" }} - {{ $pager := $page.Paginate $page.Pages }} + {{ $pager := $page.Paginate . }}
+ {{ if or $collections $sections }} +

{{ i18n "paige_pages" }}

+ {{ end }} + {{ range $pager.Pages }} {{ partial "paige/article.html" (dict "fullpages" true "page" .) }} {{ end }} @@ -18,24 +50,29 @@ {{ end }} {{ else }}
- {{ $pinned := where $page.Pages "Params.paige.pin" true }} + {{ if or $collections $sections }} +

{{ i18n "paige_pages" }}

+ {{ end }} + + {{ $pinned := where . "Params.paige.pin" true }} {{ range $pinned.ByPublishDate.Reverse }} {{ partial "paige/subpage.html" . }} {{ end }} - {{ $unpinned := complement $pinned $page.Pages }} + {{ $unpinned := complement $pinned . }} {{ $pagegroups := $unpinned.ByPublishDate.Reverse.GroupByPublishDate "January 2006" }} {{ $pager := $page.Paginate $pagegroups }} {{ range $pager.PageGroups }} -

{{ .Key }}

+

{{ .Key }}

{{ range .Pages }} {{ partial "paige/subpage.html" . }} {{ end }} {{ end }}
+ {{ if or $pager.HasPrev $pager.HasNext }}