Show, hide, style metadata, summary in page list

master
Will Faught 2 years ago
parent ddfca78aaf
commit db8469e666

@ -261,6 +261,17 @@ 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
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
rss:
managing_editor: "Michael Bluth"
web_master: "Michael Bluth"
@ -305,6 +316,17 @@ 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
show_full_pages: true # Show full pages, not just page titles and descriptions
```

@ -1,11 +1,12 @@
{{ $authors := partial "paige/func-authors.html" . }}
{{ $class := .Param "paige.about_class" | default "text-center text-secondary" }}
{{ $aboveclass := print "mb-0" " " $class }}
{{ if or $authors .PublishDate}}
{{ $class := .Params.paige.about_class | default "text-center text-secondary" }}
{{ with $authors }}
<p class="{{ cond ($.PublishDate | not | not) $aboveclass $class }}">{{ . }}</p>
{{ end }}
{{ with .PublishDate }}
<p class="{{ $class }}">
{{- with $authors }}{{ . }}{{ end -}}
{{- if and $authors .PublishDate }}<br>{{ end -}}
{{- with .PublishDate }}<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format (site.Params.paige.date_format | default ":date_long") . }}</time>{{ end -}}
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format (site.Params.paige.date_format | default ":date_long") . }}</time>
</p>
{{ end }}

@ -18,11 +18,39 @@
{{ $p := .Paginate (.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
<section>
{{ range $p.PageGroups }}
<h5 class="text-center">{{ .Key }}</h5>
<h2 class="{{ $.Param `paige.pages.header_class` | default `h5 text-center` }}">{{ .Key }}</h2>
{{ range .Pages }}
<p class="text-center">
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>{{ with .Description }}<br>{{ . | markdownify }}{{ end }}
{{ $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 }}
{{ $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 }}">
<a href="{{ .RelPermalink }}">{{ $title | markdownify }}</a>
</p>
{{ with $description }}
<p class="{{ if or $authors $date $summary }} {{ $gap }} {{ end }} {{ $descriptionclass }}">{{ . }}</p>
{{ end }}
{{ with $authors }}
<p class="{{ if or $date $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
{{ end }}
{{ with $date }}
<p class="{{ if $summary }} {{ $gap }} {{ end }} {{ $dateclass }}">
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format (site.Params.paige.date_format | default ":date_long") . }}</time>
</p>
{{ end }}
{{ if $summary }}
<p class="{{ $summaryclass }}">{{ $summary }}</p>
{{ end }}
{{ end }}
{{ end }}
</section>

Loading…
Cancel
Save