From 98ae0e465820783eddd6b4628ecccb94e87a16b3 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sun, 29 Jan 2023 16:46:10 -0800 Subject: [PATCH] Add page categories --- README.md | 6 ++++++ layouts/partials/paige/about.html | 15 ++++++++++++--- layouts/partials/paige/pages.html | 19 ++++++++++++++----- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 118c035b..f8df719a 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,9 @@ paige: authors: class: "text-center text-secondary" # Default is "text-center text-secondary" hide: false # Default is false + categories: + class: "badge text-bg-secondary text-decoration-none" # Default is "badge text-bg-secondary text-decoration-none" + show: false # Default is false content: class: "" # Default is "" hide: false # Default is false @@ -284,6 +287,9 @@ paige: authors: class: "text-center text-secondary" # Default is "text-center text-secondary" show: false # Default is false + categories: + class: "badge text-bg-secondary text-decoration-none" # Default is "badge text-bg-secondary text-decoration-none" + show: false # Default is false date: class: "text-center text-secondary" # Default is "text-center text-secondary" format: ":date_long" # Default is ":date_long" diff --git a/layouts/partials/paige/about.html b/layouts/partials/paige/about.html index 924f051a..75d5436e 100644 --- a/layouts/partials/paige/about.html +++ b/layouts/partials/paige/about.html @@ -2,6 +2,8 @@ {{ $authors := cond ($page.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" $page) "" }} {{ $authorsclass := $page.Param "paige.page.authors.class" | default "text-center text-secondary" }} +{{ $categories := cond ($page.Param "paige.page.categories.show" | not) slice ($page.Params.categories | default slice) | sort | uniq }} +{{ $categoriesclass := $page.Param "paige.page.categories.class" | default "badge text-bg-secondary text-decoration-none" }} {{ $gap := "mb-0" }} {{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }} {{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }} @@ -9,13 +11,20 @@ {{ $readingtimeclass := $page.Param "paige.page.reading_time.class" | default "text-center text-secondary" }} {{ with $authors }} -

{{ . }}

+

{{ . }}

{{ end }} {{ with $date }} -

+

{{ end }} {{ if $readingtime }} -

{{ $page.ReadingTime }} {{ i18n "paige_minutes" $page.ReadingTime }}

+

{{ $page.ReadingTime }} {{ i18n "paige_minutes" $page.ReadingTime }}

+{{ end }} +{{ with $categories }} +

+ {{ range . }} + {{ . }} + {{ end }} +

{{ end }} diff --git a/layouts/partials/paige/pages.html b/layouts/partials/paige/pages.html index 863bd253..76cc1540 100644 --- a/layouts/partials/paige/pages.html +++ b/layouts/partials/paige/pages.html @@ -28,6 +28,8 @@ {{ $authors := cond ($page.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }} {{ $authorsclass := $page.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }} + {{ $categories := cond ($page.Param "paige.page_list.categories.show" | not) slice (.Params.categories | default slice) | sort | uniq }} + {{ $categoriesclass := $page.Param "paige.page_list.categories.class" | default "badge text-bg-secondary text-decoration-none" }} {{ $date := cond ($page.Param "paige.page_list.date.show" | not) "" .PublishDate }} {{ $dateclass := $page.Param "paige.page_list.date.class" | default (print $class " text-secondary") }} {{ $description := cond ($page.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }} @@ -59,22 +61,29 @@ {{ $flags = delimit ($flags | sort | uniq) " " }} -

+

{{ $title | markdownify }}

{{ with $description }} -

{{ . }}

+

{{ . }}

{{ end }} {{ with $authors }} -

{{ . }}

+

{{ . }}

{{ end }} {{ if $date }} -

+

{{ end }} {{ if $readingtime }} -

{{ .ReadingTime }} {{ i18n "paige_minutes" .ReadingTime }}

+

{{ .ReadingTime }} {{ i18n "paige_minutes" .ReadingTime }}

+ {{ end }} + {{ with $categories }} +

+ {{ range . }} + {{ . }} + {{ end }} +

{{ end }} {{ if $summary }}

{{ $summary }}