Add config to hide page data

This commit is contained in:
Will Faught
2023-01-28 18:24:59 -08:00
parent a2b36a4208
commit 388b7d757a
5 changed files with 24 additions and 22 deletions

View File

@@ -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" }}
{{ $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" }}
{{ with $authors }}

View File

@@ -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 $class }}
<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 }}
{{ with $content }}
<section class="paige-content {{ with $class }} {{ . }} {{ end }}">
{{ . }}
</section>
{{ end }}

View File

@@ -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 }}

View File

@@ -1,6 +1,6 @@
{{ if .Title }}
{{ $class := .Param "paige.page.title_class" | default "display-5 fw-bold text-center" }}
{{ $title := .Title | markdownify }}
{{ $class := .Param "paige.page.title_class" | default "display-5 fw-bold text-center" }}
{{ $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>
{{ end }}