Add config to hide page data

master
Will Faught 2 years ago
parent a2b36a4208
commit 388b7d757a

@ -266,6 +266,11 @@ paige:
content_class: "fst-italic" # Page content class content_class: "fst-italic" # Page content class
date_class: "text-center text-secondary" # Page date class date_class: "text-center text-secondary" # Page date class
description_class: "lead text-center" # Page description 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 title_class: "display-5 fw-bold text-center" # Page title class
pages: # Page lists in list and term default layouts pages: # Page lists in list and term default layouts
authors_class: "text-center text-secondary" # Page authors class attribute authors_class: "text-center text-secondary" # Page authors class attribute
@ -306,6 +311,11 @@ paige:
content_class: "fst-italic" # Page content class content_class: "fst-italic" # Page content class
date_class: "text-center text-secondary" # Page date class date_class: "text-center text-secondary" # Page date class
description_class: "lead text-center" # Page description 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 title_class: "display-5 fw-bold text-center" # Page title class
toc: true # Show a table of contents if there are any headers toc: true # Show a table of contents if there are any headers
``` ```

@ -1,7 +1,7 @@
{{ $authors := partial "paige/func-authors.html" . }} {{ $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" }} {{ $authorsclass := .Param "paige.page.authors_class" | default "text-center text-secondary" }}
{{ $gap := "mb-0" }} {{ $gap := "mb-0" }}
{{ $date := .PublishDate }} {{ $date := cond (.Param "paige.page.hide_date" | not | not) "" .PublishDate }}
{{ $dateclass := .Param "paige.page.date_class" | default "text-center text-secondary" }} {{ $dateclass := .Param "paige.page.date_class" | default "text-center text-secondary" }}
{{ with $authors }} {{ with $authors }}

@ -1,17 +1,8 @@
{{ if .Content }} {{ $class := .Param "paige.page.content_class" }}
{{ $class := $.Param "paige.page.content_class" }} {{ $content := cond (.Scratch.Get "paige_show_full_pages" | not | not) .Content (.Content | replaceRE `(<h[1-6] id="([^"]+)".+)(</h[1-6]+>)` `${1}<a aria-label="Link to this section" class="paige-header-link" href="#${2}">#</a>${3}` | safeHTML) }}
<section class="paige-content"> {{ with $content }}
{{ with $class }} <section class="paige-content {{ with $class }} {{ . }} {{ end }}">
<div class="{{ . }}"> {{ . }}
{{ end }}
{{ if .Scratch.Get "paige_show_full_pages" }}
{{ .Content }}
{{ else }}
{{ .Content | replaceRE `(<h[1-6] id="([^"]+)".+)(</h[1-6]+>)` `${1}<a aria-label="Link to this section" class="paige-header-link" href="#${2}">#</a>${3}` | safeHTML }}
{{ end }}
{{ if $class }}
</div>
{{ end }}
</section> </section>
{{ end }} {{ end }}

@ -1,5 +1,6 @@
{{ with .Description }} {{ $class := .Param "paige.page.description_class" | default "lead text-center" }}
{{ $class := $.Param "paige.page.description_class" | default "lead text-center" }} {{ $description := cond (.Param "paige.page.hide_description" | not | not) "" (.Description | markdownify) }}
<p class="{{ $class }}">{{ . | markdownify }}</p> {{ with $description }}
<p class="{{ $class }}">{{ . }}</p>
{{ end }} {{ end }}

@ -1,6 +1,6 @@
{{ if .Title }}
{{ $class := .Param "paige.page.title_class" | default "display-5 fw-bold text-center" }} {{ $class := .Param "paige.page.title_class" | default "display-5 fw-bold text-center" }}
{{ $title := .Title | markdownify }} {{ $title := cond (.Param "paige.page.hide_title" | not | not) "" (.Title | markdownify) }}
{{ if $title }}
<h1 class="{{ $class }}">{{ if .Params.link }}<a href="{{ .Params.link }}">{{ $title }}</a>{{ else }}{{ $title }}{{ end }}{{ if .Scratch.Get "paige_show_full_pages" }}<a aria-label="Link to this section" class="paige-header-link" href="{{ .RelPermalink }}">#</a>{{ end }}</h1> <h1 class="{{ $class }}">{{ if .Params.link }}<a href="{{ .Params.link }}">{{ $title }}</a>{{ else }}{{ $title }}{{ end }}{{ if .Scratch.Get "paige_show_full_pages" }}<a aria-label="Link to this section" class="paige-header-link" href="{{ .RelPermalink }}">#</a>{{ end }}</h1>
{{ end }} {{ end }}

Loading…
Cancel
Save