Add include file kind variants

This commit is contained in:
Will Faught
2025-02-07 23:21:13 -08:00
parent 49d876e533
commit 598671aab3
8 changed files with 57 additions and 47 deletions

View File

@@ -0,0 +1,25 @@
{{ $params := . }}
{{ $name := $params.name }}
{{ $page := $params.page }}
{{ $partial := print "paige/" (printf $name "") }}
{{ $file := print "partials/" $partial }}
{{ if templates.Exists $file }}
{{ partial $partial $page }}
{{ end }}
{{ range slice "home" "page" "section" "taxonomy" "term" }}
{{ $partial := print "paige/" (printf $name (print "-" .)) }}
{{ $file := print "partials/" $partial }}
{{ $exists := templates.Exists $file }}
{{ $matches := eq $page.Kind . }}
{{ if and $exists $matches }}
{{ partial $partial $page }}
{{ end }}
{{ end }}

View File

@@ -19,9 +19,7 @@
{{ if or $edit $history $first $last $next $prev }}
<footer class="mw-100" id="paige-page-footer">
{{ if $first }}
{{ partial "paige/page-footer-first.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "page-footer-first%s.html" "page" $page) }}
{{ if or $edit $history }}
<div id="paige-file">
@@ -51,8 +49,6 @@
</div>
{{ end }}
{{ if $last }}
{{ partial "paige/page-footer-last.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "page-footer-last%s.html" "page" $page) }}
</footer>
{{ end }}

View File

@@ -22,9 +22,7 @@
{{ if or $alert $authors $date $description $first $keywords $last $time $series $title $toc }}
<header class="mw-100" id="paige-page-header">
<div class="align-items-center d-flex flex-column">
{{ if $first }}
{{ partial "paige/page-header-first.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "page-header-first%s.html" "page" $page) }}
{{ with $title }}
<h1 class="fw-bold" id="paige-page-title" {{ if $microdata }} itemprop="headline name" {{ end }}>{{ if $link }}<a href="{{ $link }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}</h1>
@@ -104,9 +102,7 @@
</div>
{{ end }}
{{ if $last }}
{{ partial "paige/page-header-last.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "page-header-last%s.html" "page" $page) }}
</div>
</header>
{{ end }}

View File

@@ -17,9 +17,7 @@
{{ if or $copyright $credit $first $last $license }}
<footer id="paige-site-footer">
{{ if $first }}
{{ partial "paige/site-footer-first.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "site-footer-first%s.html" "page" $page) }}
{{ with $copyright }}
<p class="paige-row-short text-center text-secondary" id="paige-copyright" {{ if $microdata }} itemprop="copyrightNotice" {{ end }}>{{ . }}</p>
@@ -33,8 +31,6 @@
<p class="paige-row-short text-center text-secondary" id="paige-credit">{{ . }}</p>
{{ end }}
{{ if $last }}
{{ partial "paige/site-footer-last.html" . }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "site-footer-last%s.html" "page" $page) }}
</footer>
{{ end }}

View File

@@ -34,9 +34,7 @@
{{ if or $breadcrumbs $description $first $last $menu $title }}
<header id="paige-site-header">
{{ if $first }}
{{ partial "paige/site-header-first.html" $page }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "site-header-first%s.html" "page" $page) }}
{{ with $title }}
<div class="display-1 fw-bold {{ if $description }} mb-2 {{ end }} paige-row-tall text-center" id="paige-site-title">{{ . }}</div>
@@ -162,8 +160,6 @@
</nav>
{{ end }}
{{ if $last }}
{{ partial "paige/site-header-last.html" $page }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "site-header-last%s.html" "page" $page) }}
</header>
{{ end }}

View File

@@ -23,10 +23,7 @@
{{ $title = delimit $titles " · " }}
<head>
{{ if templates.Exists "partials/paige/head-first.html" }}
{{ partial "paige/head-first.html" $page }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "head-first%s.html" "page" $page) }}
{{ partial "paige/metas.html" $page }}
{{ with $title }}
@@ -35,8 +32,5 @@
{{ partial "paige/links.html" $page }}
{{ partial "paige/style.html" $page }}
{{ if templates.Exists "partials/paige/head-last.html" }}
{{ partial "paige/head-last.html" $page }}
{{ end }}
{{ partial "paige/func-include.html" (dict "name" "head-last%s.html" "page" $page) }}
</head>