From ffb4ff8b5f856c3a35bc3e09ffa65b14b393341a Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 28 Jan 2023 11:36:51 -0800 Subject: [PATCH] Add page flags to page list --- README.md | 17 +++++++++++++++++ layouts/partials/paige/pages.html | 21 ++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eb80be6f..36349f4d 100644 --- a/README.md +++ b/README.md @@ -820,6 +820,23 @@ replace the use of `paige/article.html` in `single.html` with the use of `paige/title.html`, `paige/description.html`, `paige/other.html`, `paige/toc.html`, and `paige/content.html`, then replace that use of `paige/title.html` with your own design. +### Define + +These optional CSS classes can be defined how you want: + +
+
.paige-draft
+
Applied to the title of draft pages in the list and term default layouts.
+
.paige-expired
+
Applied to the title of expired pages in the list and term default layouts.
+
.paige-future
+
Applied to the title of future pages in the list and term default layouts.
+
.paige-modified
+
Applied to the title of modified pages in the list and term default layouts.
+
.paige-unpublished
+
Applied to the title of unpublished (draft, expired, future) pages in the list and term default layouts.
+
+ ## Design The HTML author is the page authors, if any. diff --git a/layouts/partials/paige/pages.html b/layouts/partials/paige/pages.html index 892bf38d..acfe08de 100644 --- a/layouts/partials/paige/pages.html +++ b/layouts/partials/paige/pages.html @@ -28,13 +28,32 @@ {{ $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 }} + {{ $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 }} {{ $titleclass := $.Param "paige.pages.title_class" | default $class }} -

+ {{ if .Draft }} + {{ $flags = $flags | append "paige-draft" "paige-unpublished" }} + {{ end }} + + {{ if and .ExpiryDate (lt .ExpiryDate now) }} + {{ $flags = $flags | append "paige-expired" "paige-unpublished" }} + {{ end }} + + {{ if and .PublishDate (gt .PublishDate now) }} + {{ $flags = $flags | append "paige-future" "paige-unpublished" }} + {{ end }} + + {{ if and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }} + {{ $flags = $flags | append "paige-modified" }} + {{ end }} + + {{ $flags = delimit ($flags | sort | uniq) " " }} + +

{{ $title | markdownify }}

{{ with $description }}