Add page flags to page list
This commit is contained in:
17
README.md
17
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:
|
||||
|
||||
<dl>
|
||||
<dt><code>.paige-draft</code></dt>
|
||||
<dd>Applied to the title of draft pages in the list and term default layouts.</dd>
|
||||
<dt><code>.paige-expired</code></dt>
|
||||
<dd>Applied to the title of expired pages in the list and term default layouts.</dd>
|
||||
<dt><code>.paige-future</code></dt>
|
||||
<dd>Applied to the title of future pages in the list and term default layouts.</dd>
|
||||
<dt><code>.paige-modified</code></dt>
|
||||
<dd>Applied to the title of modified pages in the list and term default layouts.</dd>
|
||||
<dt><code>.paige-unpublished</code></dt>
|
||||
<dd>Applied to the title of unpublished (draft, expired, future) pages in the list and term default layouts.</dd>
|
||||
</dl>
|
||||
|
||||
## Design
|
||||
|
||||
The HTML author is the page authors, if any.
|
||||
|
@@ -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 "<p>" | strings.TrimSuffix "</p>") "" }}
|
||||
{{ $summaryclass := $.Param "paige.pages.summary_class" | default $class }}
|
||||
{{ $title := .Title | markdownify }}
|
||||
{{ $titleclass := $.Param "paige.pages.title_class" | default $class }}
|
||||
|
||||
<p class="{{ if or $description $authors $date $summary }} {{ $gap }} {{ end }} {{ $titleclass }}">
|
||||
{{ 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) " " }}
|
||||
|
||||
<p class="{{ if or $description $authors $date $summary }} {{ $gap }} {{ end }} {{ with $flags }} {{ . }} {{ end }} {{ $titleclass }}">
|
||||
<a href="{{ .RelPermalink }}">{{ $title | markdownify }}</a>
|
||||
</p>
|
||||
{{ with $description }}
|
||||
|
Reference in New Issue
Block a user