From 2c4f4324ff95ceb38fbcd8c11e4693630436d610 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 28 Jan 2023 19:32:21 -0800 Subject: [PATCH] Replace some page config prefixes with nesting --- README.md | 110 +++++++++++++++--------- layouts/partials/paige/about.html | 8 +- layouts/partials/paige/content.html | 8 +- layouts/partials/paige/description.html | 4 +- layouts/partials/paige/pages.html | 22 ++--- layouts/partials/paige/title.html | 4 +- 6 files changed, 94 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index a1b60a72..14da76fe 100644 --- a/README.md +++ b/README.md @@ -261,28 +261,41 @@ paige: menu_breakpoint: "sm" # Bootstrap breakpoint at which to display all menu items menu_style: "pills" # Menu item style; must be "links" or "pills"; default is "pills" metadata_max_width: "100ch" # Page metadata max width - page: # Every page - authors_class: "text-center text-secondary" # Page authors class - content_class: "fst-italic" # Page content class - date_class: "text-center text-secondary" # Page date class - description_class: "lead text-center" # Page description class - hide_authors: false # Hide the page authors (default is false) - hide_content: false # Hide the page authors (default is false) - hide_date: false # Hide the page date (default is false) - hide_description: false # Hide the page description (default is false) - hide_title: false # Hide the page title (default is false) - title_class: "display-5 fw-bold text-center" # Page title class + page: + authors: + class: "text-center text-secondary" # Default is "text-center text-secondary" + hide: false # Default is false + content: + class: "" # Default is "" + hide: false # Default is false + date: + class: "text-center text-secondary" # Default is "text-center text-secondary" + hide: false # Default is false + description: + class: "lead text-center" # Default is "lead text-center" + hide: false # Default is false + title: + class: "display-5 fw-bold text-center" # Default is "display-5 fw-bold text-center" + hide: false # Default is false pages: # Page lists in list and term default layouts - authors_class: "text-center text-secondary" # Page authors class attribute - date_class: "text-center text-secondary" # Page date class attribute - description_class: "text-center" # Page description class attribute - header_class: "h5 text-center" # Month and year header class attribute - hide_description: false # Hide the page description (default is true) - show_authors: false # Show the page authors (default is false) - show_date: false # Show the page date (default is false) - show_summary: false # Show the page summary (default is false) - summary_class: "text-center" # Page summary class attribute - title_class: "text-center" # Page title class attribute + authors: + class: "text-center text-secondary" # Default is "text-center text-secondary" + show: false # Default is false + date: + class: "text-center text-secondary" # Default is "text-center text-secondary" + show: false # Default is false + description: + class: "text-center" # Default is "text-center" + hide: false # Default is false + header: + class: "h5 text-center" # Month and year header class attribute + hide: false # Default is false + summary: + class: "text-center" # Default is "text-center" + show: false # Default is false + title: + class: "text-center" # Default is "text-center" + hide: false # Default is false rss: managing_editor: "Michael Bluth" web_master: "Michael Bluth" @@ -307,16 +320,21 @@ link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the ti paige: math: true # Enable math typesetting with KaTeX page: - authors_class: "text-center text-secondary" # Page authors class - content_class: "fst-italic" # Page content class - date_class: "text-center text-secondary" # Page date class - description_class: "lead text-center" # Page description class - hide_authors: false # Hide the page authors (default is false) - hide_content: false # Hide the page authors (default is false) - hide_date: false # Hide the page date (default is false) - hide_description: false # Hide the page description (default is false) - hide_title: false # Hide the page title (default is false) - title_class: "display-5 fw-bold text-center" # Page title class + authors: + class: "text-center text-secondary" # Default is "text-center text-secondary" + hide: false # Default is false + content: + class: "" # Default is "" + hide: false # Default is false + date: + class: "text-center text-secondary" # Default is "text-center text-secondary" + hide: false # Default is false + description: + class: "lead text-center" # Default is "lead text-center" + hide: false # Default is false + title: + class: "display-5 fw-bold text-center" # Default is "display-5 fw-bold text-center" + hide: false # Default is false toc: true # Show a table of contents if there are any headers ``` @@ -334,17 +352,25 @@ Additional optional list page parameters: ```yaml paige: - pages: # Page list - authors_class: "text-center text-secondary" # Page authors class attribute - date_class: "text-center text-secondary" # Page date class attribute - description_class: "text-center" # Page description class attribute - header_class: "h5 text-center" # Month and year header class attribute - hide_description: false # Hide the page description (default is true) - show_authors: false # Show the page authors (default is false) - show_date: false # Show the page date (default is false) - show_summary: false # Show the page summary (default is false) - summary_class: "text-center" # Page summary class attribute - title_class: "text-center" # Page title class attribute + page_list: + authors: + class: "text-center text-secondary" # Default is "text-center text-secondary" + show: false # Default is false + date: + class: "text-center text-secondary" # Default is "text-center text-secondary" + show: false # Default is false + description: + class: "text-center" # Default is "text-center" + hide: false # Default is false + header: + class: "h5 text-center" # Month and year header class attribute + hide: false # Default is false + summary: + class: "text-center" # Default is "text-center" + show: false # Default is false + title: + class: "text-center" # Default is "text-center" + hide: false # Default is false show_full_pages: true # Show full pages, not just page titles and descriptions ``` diff --git a/layouts/partials/paige/about.html b/layouts/partials/paige/about.html index e384ac4c..4d2822e2 100644 --- a/layouts/partials/paige/about.html +++ b/layouts/partials/paige/about.html @@ -1,8 +1,8 @@ -{{ $authors := cond (.Param "paige.page.hide_authors" | not | not) "" (partial "paige/func-authors.html" .) }} -{{ $authorsclass := .Param "paige.page.authors_class" | default "text-center text-secondary" }} +{{ $authors := cond (.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" .) "" }} +{{ $authorsclass := .Param "paige.page.authors.class" | default "text-center text-secondary" }} {{ $gap := "mb-0" }} -{{ $date := cond (.Param "paige.page.hide_date" | not | not) "" .PublishDate }} -{{ $dateclass := .Param "paige.page.date_class" | default "text-center text-secondary" }} +{{ $date := cond (.Param "paige.page.date.hide" | not) .PublishDate "" }} +{{ $dateclass := .Param "paige.page.date.class" | default "text-center text-secondary" }} {{ with $authors }}

{{ . }}

diff --git a/layouts/partials/paige/content.html b/layouts/partials/paige/content.html index 58fb8229..a270b85b 100644 --- a/layouts/partials/paige/content.html +++ b/layouts/partials/paige/content.html @@ -1,5 +1,9 @@ -{{ $class := .Param "paige.page.content_class" }} -{{ $content := cond (.Scratch.Get "paige_show_full_pages" | not | not) .Content (.Content | replaceRE `()` `${1}#${3}` | safeHTML) }} +{{ $class := .Param "paige.page.content.class" }} +{{ $content := "" }} + +{{ if .Param "paige.page.title.hide" | not }} + {{ $content = cond (.Scratch.Get "paige_show_full_pages" | not | not) .Content (.Content | replaceRE `()` `${1}#${3}` | safeHTML) }} +{{ end }} {{ with $content }}
diff --git a/layouts/partials/paige/description.html b/layouts/partials/paige/description.html index 5fde675f..ca90949a 100644 --- a/layouts/partials/paige/description.html +++ b/layouts/partials/paige/description.html @@ -1,5 +1,5 @@ -{{ $class := .Param "paige.page.description_class" | default "lead text-center" }} -{{ $description := cond (.Param "paige.page.hide_description" | not | not) "" (.Description | markdownify) }} +{{ $class := .Param "paige.page.description.class" | default "lead text-center" }} +{{ $description := cond (.Param "paige.page.description.hide" | not) (.Description | markdownify) "" }} {{ with $description }}

{{ . }}

diff --git a/layouts/partials/paige/pages.html b/layouts/partials/paige/pages.html index acfe08de..7e0ac380 100644 --- a/layouts/partials/paige/pages.html +++ b/layouts/partials/paige/pages.html @@ -18,21 +18,23 @@ {{ $p := .Paginate (.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
{{ range $p.PageGroups }} -

{{ .Key }}

+ {{ if $.Param "paige.pages.header.hide" | not }} +

{{ .Key }}

+ {{ end }} {{ range .Pages }} {{ $class := "text-center" }} - {{ $authors := cond ($.Param "paige.pages.show_authors" | not | not) (partial "paige/func-authors.html" .) "" }} - {{ $authorsclass := $.Param "paige.pages.authors_class" | default (print $class " text-secondary") }} - {{ $date := cond ($.Param "paige.pages.show_date" | not | not) .PublishDate "" }} - {{ $dateclass := $.Param "paige.pages.date_class" | default (print $class " text-secondary") }} - {{ $description := cond ($.Param "paige.pages.hide_description" | not) (.Description | markdownify) "" }} - {{ $descriptionclass := $.Param "paige.pages.description_class" | default $class }} + {{ $authors := cond ($.Param "paige.pages.authors.show" | not) "" (partial "paige/func-authors.html" .) }} + {{ $authorsclass := $.Param "paige.pages.authors.class" | default (print $class " text-secondary") }} + {{ $date := cond ($.Param "paige.pages.date.show" | not) "" .PublishDate }} + {{ $dateclass := $.Param "paige.pages.date.class" | default (print $class " text-secondary") }} + {{ $description := cond ($.Param "paige.pages.description.hide" | not) (.Description | markdownify) "" }} + {{ $descriptionclass := $.Param "paige.pages.description.class" | default $class }} {{ $flags := slice }} {{ $gap := "mb-0" }} - {{ $summary := cond ($.Param "paige.pages.show_summary" | not | not) (.Summary | strings.TrimPrefix "

" | strings.TrimSuffix "

") "" }} - {{ $summaryclass := $.Param "paige.pages.summary_class" | default $class }} - {{ $title := .Title | markdownify }} + {{ $summary := cond ($.Param "paige.pages.summary.show" | not) "" (.Summary | strings.TrimPrefix "

" | strings.TrimSuffix "

") }} + {{ $summaryclass := $.Param "paige.pages.summary.class" | default $class }} + {{ $title := cond ($.Param "paige.pages.title.hide" | not) (.Title | markdownify) "" }} {{ $titleclass := $.Param "paige.pages.title_class" | default $class }} {{ if .Draft }} diff --git a/layouts/partials/paige/title.html b/layouts/partials/paige/title.html index 7e466673..23500244 100644 --- a/layouts/partials/paige/title.html +++ b/layouts/partials/paige/title.html @@ -1,5 +1,5 @@ -{{ $class := .Param "paige.page.title_class" | default "display-5 fw-bold text-center" }} -{{ $title := cond (.Param "paige.page.hide_title" | not | not) "" (.Title | markdownify) }} +{{ $class := .Param "paige.page.title.class" | default "display-5 fw-bold text-center" }} +{{ $title := cond (.Param "paige.page.title.hide" | not) (.Title | markdownify) "" }} {{ if $title }}

{{ if .Params.link }}{{ $title }}{{ else }}{{ $title }}{{ end }}{{ if .Scratch.Get "paige_show_full_pages" }}#{{ end }}