Assign template context to var

master
Will Faught 2 years ago
parent 548af63634
commit 64e148ab6f

@ -1,35 +1,37 @@
{{ $page := . }}
<!doctype html> <!doctype html>
{{ $rtl := eq .Language.LanguageDirection "rtl" }} {{ $rtl := eq $page.Language.LanguageDirection "rtl" }}
{{ $lang := .Site.LanguageCode | default .Site.Language.Lang }} {{ $lang := $page.Site.LanguageCode | default $page.Site.Language.Lang }}
<html {{ if eq .Site.Params.paige.color_scheme `dark` }} data-bs-theme="dark" {{ end }} {{ if $rtl }} dir="rtl" {{ end }} {{ with $lang }} lang="{{ . }}" {{ end }}> <html {{ if eq $page.Site.Params.paige.color_scheme `dark` }} data-bs-theme="dark" {{ end }} {{ if $rtl }} dir="rtl" {{ end }} {{ with $lang }} lang="{{ . }}" {{ end }}>
{{ partial "paige/head.html" . }} {{ partial "paige/head.html" $page }}
{{ partial "paige/body.html" . }} {{ partial "paige/body.html" $page }}
{{ if templates.Exists "partials/paige/body-first.html" }} {{ if templates.Exists "partials/paige/body-first.html" }}
{{ partial "paige/body-first.html" . }} {{ partial "paige/body-first.html" $page }}
{{ end }} {{ end }}
<div class="container flex-fill"> <div class="container flex-fill">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
{{ partial "paige/header.html" . }} {{ partial "paige/header.html" $page }}
<main> <main>
{{ if templates.Exists "partials/paige/main-first.html" }} {{ if templates.Exists "partials/paige/main-first.html" }}
{{ partial "paige/main-first.html" . }} {{ partial "paige/main-first.html" $page }}
{{ end }} {{ end }}
{{ block "main" . }}{{ end }} {{ block "main" $page }}{{ end }}
{{ if templates.Exists "partials/paige/main-last.html" }} {{ if templates.Exists "partials/paige/main-last.html" }}
{{ partial "paige/main-last.html" . }} {{ partial "paige/main-last.html" $page }}
{{ end }} {{ end }}
</main> </main>
{{ partial "paige/footer.html" . }} {{ partial "paige/footer.html" $page }}
</div> </div>
</div> </div>
</div> </div>
{{ partial "paige/scripts.html" . }} {{ partial "paige/scripts.html" $page }}
{{ if templates.Exists "partials/paige/body-last.html" }} {{ if templates.Exists "partials/paige/body-last.html" }}
{{ partial "paige/body-last.html" . }} {{ partial "paige/body-last.html" $page }}
{{ end }} {{ end }}
</body> </body>
</html> </html>
{{ if not .Site.Params.paige.hide_theme_comment }} {{ if not $page.Site.Params.paige.hide_theme_comment }}
{{ printf "<!-- Paige theme from https://github.com/willfaught/paige -->" | safeHTML }} {{ printf "<!-- Paige theme from https://github.com/willfaught/paige -->" | safeHTML }}
{{ end }} {{ end }}

@ -1,14 +1,16 @@
{{ define "main" }} {{ define "main" }}
{{ $page := . }}
<article> <article>
{{ partial "paige/metadata.html" . }} {{ partial "paige/metadata.html" $page }}
<section> <section>
{{ if .Params.image_url }} {{ if $page.Params.image_url }}
{{ $class := "mw-100 rounded-4 shadow" }} {{ $class := "mw-100 rounded-4 shadow" }}
{{ if .Params.image_stretch }} {{ if $page.Params.image_stretch }}
{{ $class = "rounded-4 shadow w-100" }} {{ $class = "rounded-4 shadow w-100" }}
{{ end }} {{ end }}
{{ $style := "height: 20rem" }} {{ $style := "height: 20rem" }}
{{ if .Params.image_stretch }} {{ if $page.Params.image_stretch }}
{{ $style = "height: 20rem; object-fit: cover" }} {{ $style = "height: 20rem; object-fit: cover" }}
{{ end }} {{ end }}
<p {{ if not .Params.image_stretch }} class="text-center" {{ end }}> <p {{ if not .Params.image_stretch }} class="text-center" {{ end }}>
@ -22,10 +24,10 @@
) }} ) }}
</p> </p>
{{ end }} {{ end }}
{{ with .Params.greeting }} {{ with $page.Params.greeting }}
<p class="display-5 fw-bold h2 text-center">{{ . | markdownify }}</p> <p class="display-5 fw-bold h2 text-center">{{ . | markdownify }}</p>
{{ end }} {{ end }}
{{ with .Params.blurb }} {{ with $page.Params.blurb }}
<div class="container-fluid"> <div class="container-fluid">
<div class="justify-content-center row"> <div class="justify-content-center row">
<div class="col col-auto col-lg-7 px-0"> <div class="col col-auto col-lg-7 px-0">
@ -35,8 +37,8 @@
</div> </div>
{{ end }} {{ end }}
</section> </section>
{{ partial "paige/toc.html" . }} {{ partial "paige/toc.html" $page }}
{{ partial "paige/content.html" . }} {{ partial "paige/content.html" $page }}
{{ partial "paige/social.html" . }} {{ partial "paige/social.html" $page }}
</article> </article>
{{ end }} {{ end }}

@ -1,6 +1,8 @@
{{- $.Scratch.Add "index" slice -}} {{- $page := . -}}
{{- range where .Site.RegularPages "Params.paige.hide_search" "ne" true -}}
{{- $.Scratch.Add "index" (dict {{- $page.Scratch.Add "index" slice -}}
{{- range where $page.Site.RegularPages "Params.paige.hide_search" "ne" true -}}
{{- $page.Scratch.Add "index" (dict
"categories" .Params.categories "categories" .Params.categories
"date" .PublishDate "date" .PublishDate
"description" (.Description | markdownify | plainify | htmlUnescape) "description" (.Description | markdownify | plainify | htmlUnescape)
@ -10,4 +12,4 @@
"text" (strings.TrimRight " " (replace (.Plain | htmlUnescape) "\n" " ")) "text" (strings.TrimRight " " (replace (.Plain | htmlUnescape) "\n" " "))
"title" (.Title | markdownify | plainify | htmlUnescape)) -}} "title" (.Title | markdownify | plainify | htmlUnescape)) -}}
{{- end -}} {{- end -}}
{{- $.Scratch.Get "index" | jsonify -}} {{- $page.Scratch.Get "index" | jsonify -}}

@ -1,6 +1,8 @@
{{ define "main" }} {{ define "main" }}
{{ $page := . }}
{{ if not .Params.paige.show_full_pages }} {{ if not .Params.paige.show_full_pages }}
{{ partial "paige/article.html" . }} {{ partial "paige/article.html" $page }}
{{ end }} {{ end }}
{{ partial "paige/pages.html" . }} {{ partial "paige/pages.html" $page }}
{{ end }} {{ end }}

@ -1,43 +1,45 @@
{{ $item := . }} {{ $page := . }}
{{ if .IsHome }}
{{ $item = .Site }} {{ $item := $page }}
{{ if $page.IsHome }}
{{ $item = $page.Site }}
{{ end }} {{ end }}
{{ $pages := slice }} {{ $pages := slice }}
{{ if or $.IsHome $.IsSection }} {{ if or $page.IsHome $page.IsSection }}
{{ $pages = $item.RegularPages }} {{ $pages = $item.RegularPages }}
{{ else }} {{ else }}
{{ $pages = $item.Pages }} {{ $pages = $item.Pages }}
{{ end }} {{ end }}
{{ $limit := .Site.Config.Services.RSS.Limit }} {{ $limit := $page.Site.Config.Services.RSS.Limit }}
{{ if ge $limit 1 }} {{ if ge $limit 1 }}
{{ $pages = $pages | first $limit }} {{ $pages = $pages | first $limit }}
{{ end }} {{ end }}
{{ $pages = where $pages "Params.paige.hide_rss" "ne" true }} {{ $pages = where $pages "Params.paige.hide_rss" "ne" true }}
{{ $title := partial "paige/func-title.html" . }} {{ $title := partial "paige/func-title.html" $page }}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
{{ with .OutputFormats.Get "RSS" }} {{ with $page.OutputFormats.Get "RSS" }}
{{ printf `<atom:link href="%s" rel="self" type="%s"/>` .Permalink .MediaType | safeHTML }} {{ printf `<atom:link href="%s" rel="self" type="%s"/>` .Permalink .MediaType | safeHTML }}
{{ end }} {{ end }}
{{ with .Site.Copyright }} {{ with $page.Site.Copyright }}
<copyright>{{ . }}</copyright> <copyright>{{ . }}</copyright>
{{ end }} {{ end }}
<description>{{ with $title }}{{ . }}{{ else }}Recent content{{ end }}</description> <description>{{ with $title }}{{ . }}{{ else }}Recent content{{ end }}</description>
{{ with .Site.LanguageCode | default .Site.Language.Lang }} {{ with $page.Site.LanguageCode | default .Site.Language.Lang }}
<language>{{ . }}</language> <language>{{ . }}</language>
{{ end }} {{ end }}
{{ if and .Date (not .Date.IsZero) }} {{ if and $page.Date (not $page.Date.IsZero) }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate> <lastBuildDate>{{ $page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{ end }} {{ end }}
<link>{{ .Permalink }}</link> <link>{{ $page.Permalink }}</link>
{{ with .Site.Params.paige.rss.managing_editor }} {{ with $page.Site.Params.paige.rss.managing_editor }}
<managingEditor>{{ . }}</managingEditor> <managingEditor>{{ . }}</managingEditor>
{{ end }} {{ end }}
{{ with $title }} {{ with $title }}
<title>{{ . }}</title> <title>{{ . }}</title>
{{ end }} {{ end }}
{{ with .Site.Params.paige.rss.web_master }} {{ with $page.Site.Params.paige.rss.web_master }}
<webMaster>{{ . }}</webMaster> <webMaster>{{ . }}</webMaster>
{{ end }} {{ end }}
{{ range $pages }} {{ range $pages }}

@ -1,4 +1,6 @@
{{ define "main" }} {{ define "main" }}
{{ partial "paige/article.html" . }} {{ $page := . }}
{{ partial "paige/comments.html" . }}
{{ partial "paige/article.html" $page }}
{{ partial "paige/comments.html" $page }}
{{ end }} {{ end }}

@ -1,9 +1,11 @@
{{ define "main" }} {{ define "main" }}
{{ partial "paige/article.html" . }} {{ $page := . }}
{{ if .Pages }}
{{ partial "paige/article.html" $page }}
{{ if $page.Pages }}
<section> <section>
<ul class="list-inline text-center"> <ul class="list-inline text-center">
{{ range (sort .Pages "Title") }} {{ range (sort $page.Pages "Title") }}
<li class="list-inline-item"> <li class="list-inline-item">
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a> <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</li> </li>

@ -1,4 +1,6 @@
{{ define "main" }} {{ define "main" }}
{{ partial "paige/article.html" . }} {{ $page := . }}
{{ partial "paige/pages.html" . }}
{{ partial "paige/article.html" $page }}
{{ partial "paige/pages.html" $page }}
{{ end }} {{ end }}

@ -1,6 +1,8 @@
{{ $class := .class }} {{ $params := . }}
{{ $content := .content }}
{{ $href := .href }} {{ $class := $params.class }}
{{ $style := .style }} {{ $content := $params.content }}
{{ $href := $params.href }}
{{ $style := $params.style }}
<a {{ with $class }} class="{{ . }}" {{ end }} {{ with $href }} href="{{ . | safeURL }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }}>{{ $content }}</a> <a {{ with $class }} class="{{ . }}" {{ end }} {{ with $href }} href="{{ . | safeURL }}" {{ end }} {{ with $style }} style="{{ . | safeCSS }}" {{ end }}>{{ $content }}</a>

@ -1,14 +1,16 @@
{{ $authors := cond (.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" .) "" }} {{ $page := . }}
{{ $authorsclass := .Param "paige.page.authors.class" | default "text-center text-secondary" }}
{{ $authors := cond ($page.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" $page) "" }}
{{ $authorsclass := $page.Param "paige.page.authors.class" | default "text-center text-secondary" }}
{{ $gap := "mb-0" }} {{ $gap := "mb-0" }}
{{ $date := cond (.Param "paige.page.date.hide" | not) .PublishDate "" }} {{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }}
{{ $dateclass := .Param "paige.page.date.class" | default "text-center text-secondary" }} {{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }}
{{ with $authors }} {{ with $authors }}
<p class="{{ if $date }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p> <p class="{{ if $date }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
{{ end }} {{ end }}
{{ if $date }} {{ with $date }}
<p class="{{ $dateclass }}"> <p class="{{ $dateclass }}">
<time datetime="{{ $date.Format `2006-01-02` }}">{{ time.Format (.Param "paige.page.date.format" | default ":date_long") $date }}</time> <time datetime="{{ .Format `2006-01-02` }}">{{ time.Format ($page.Param "paige.page.date.format" | default ":date_long") . }}</time>
</p> </p>
{{ end }} {{ end }}

@ -1,7 +1,9 @@
{{ $page := . }}
<article> <article>
<div class="align-items-center d-flex flex-column mb-0"> <div class="align-items-center d-flex flex-column mb-0">
{{ partial "paige/metadata.html" . }} {{ partial "paige/metadata.html" $page }}
{{ partial "paige/toc.html" . }} {{ partial "paige/toc.html" $page }}
{{ partial "paige/content.html" . }} {{ partial "paige/content.html" $page }}
</div> </div>
</article> </article>

@ -1,3 +1,5 @@
{{ $page := . }}
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}
{{ if site.Params.paige.comments.cactus }} {{ if site.Params.paige.comments.cactus }}
<section class="mb-3"> <section class="mb-3">
@ -10,7 +12,7 @@
defaultHomeserverUrl: "https://matrix.cactus.chat:8448", defaultHomeserverUrl: "https://matrix.cactus.chat:8448",
serverName: "cactus.chat", serverName: "cactus.chat",
siteName: {{ site.Params.paige.comments.cactus.account_id }}, siteName: {{ site.Params.paige.comments.cactus.account_id }},
commentSectionId: {{ .RelPermalink }} commentSectionId: {{ $page.RelPermalink }}
}) })
</script> </script>
<noscript>{{ i18n "paige_noscript" }}</noscript> <noscript>{{ i18n "paige_noscript" }}</noscript>
@ -30,7 +32,7 @@
var __semio__params = { var __semio__params = {
graphcommentId: {{ site.Params.paige.comments.graphcomment.account_id }}, graphcommentId: {{ site.Params.paige.comments.graphcomment.account_id }},
behaviour: { behaviour: {
uid: {{ .RelPermalink }} uid: {{ $page.RelPermalink }}
} }
}; };
function __semio__onload() { function __semio__onload() {
@ -52,7 +54,7 @@
var HYVOR_TALK_WEBSITE = {{ site.Params.paige.comments.hyvor.account_id }}; var HYVOR_TALK_WEBSITE = {{ site.Params.paige.comments.hyvor.account_id }};
var HYVOR_TALK_CONFIG = { var HYVOR_TALK_CONFIG = {
url: false, url: false,
id: {{ .RelPermalink }} id: {{ $page.RelPermalink }}
}; };
</script> </script>
<script async type="text/javascript" src="//talk.hyvor.com/web-api/embed"></script> <script async type="text/javascript" src="//talk.hyvor.com/web-api/embed"></script>
@ -63,8 +65,8 @@
<section class="mb-3"> <section class="mb-3">
<script> <script>
var idcomments_acct = {{ site.Params.paige.comments.intensedebate.account_id }}; var idcomments_acct = {{ site.Params.paige.comments.intensedebate.account_id }};
var idcomments_post_id = {{ .RelPermalink }}; var idcomments_post_id = {{ $page.RelPermalink }};
var idcomments_post_url = {{ .Permalink }}; var idcomments_post_url = {{ $page.Permalink }};
</script> </script>
<span id="IDCommentsPostTitle" style="display:none"></span> <span id="IDCommentsPostTitle" style="display:none"></span>
<script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script> <script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script>
@ -105,7 +107,7 @@
<script> <script>
window.replybox = { window.replybox = {
site: {{ site.Params.paige.comments.replybox.account_id }}, site: {{ site.Params.paige.comments.replybox.account_id }},
identifier: {{ .RelPermalink }} identifier: {{ $page.RelPermalink }}
}; };
</script> </script>
<script src="https://cdn.getreplybox.com/js/embed.js"></script> <script src="https://cdn.getreplybox.com/js/embed.js"></script>

@ -1,8 +1,10 @@
{{ $class := .Param "paige.page.content.class" }} {{ $page := . }}
{{ $class := $page.Param "paige.page.content.class" }}
{{ $content := "" }} {{ $content := "" }}
{{ if .Param "paige.page.title.hide" | not }} {{ if $page.Param "paige.page.title.hide" | not }}
{{ $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) }} {{ $content = cond ($page.Scratch.Get "paige_show_full_pages" | not | not) $page.Content ($page.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 }} {{ end }}
{{ with $content }} {{ with $content }}

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

@ -1,16 +1,18 @@
{{ $caption := .caption | markdownify }} {{ $params := . }}
{{ $compact := .compact }}
{{ $content := .content | markdownify }} {{ $caption := $params.caption | markdownify }}
{{ $float := .float }} {{ $compact := $params.compact }}
{{ $gap := .gap }} {{ $content := $params.content | markdownify }}
{{ $height := .height }} {{ $float := $params.float }}
{{ $horizontal := .horizontal | default "center" }} {{ $gap := $params.gap }}
{{ $maxheight := .maxheight }} {{ $height := $params.height }}
{{ $maxwidth := .maxwidth }} {{ $horizontal := $params.horizontal | default "center" }}
{{ $number := .number }} {{ $maxheight := $params.maxheight }}
{{ $numbered := .numbered }} {{ $maxwidth := $params.maxwidth }}
{{ $vertical := .vertical | default "center" }} {{ $number := $params.number }}
{{ $width := .width }} {{ $numbered := $params.numbered }}
{{ $vertical := $params.vertical | default "center" }}
{{ $width := $params.width }}
{{ $heightish := or $maxheight $height }} {{ $heightish := or $maxheight $height }}
{{ $showcaption := $caption }} {{ $showcaption := $caption }}

@ -1,3 +1,5 @@
{{ $page := . }}
{{ $copyright := site.Copyright }} {{ $copyright := site.Copyright }}
{{ $first := templates.Exists "partials/paige/footer-first.html" }} {{ $first := templates.Exists "partials/paige/footer-first.html" }}
{{ $last := templates.Exists "partials/paige/footer-last.html" }} {{ $last := templates.Exists "partials/paige/footer-last.html" }}

@ -1,9 +1,11 @@
{{ $page := . }}
{{ $result := "" }} {{ $result := "" }}
{{ if .Params.authors }} {{ if $page.Params.authors }}
{{ $names := slice }} {{ $names := slice }}
{{ range .Params.authors }} {{ range $page.Params.authors }}
{{ if eq (printf "%T" .) "string" }} {{ if eq (printf "%T" .) "string" }}
{{ $names = $names | append (index site.Params.authors .).name }} {{ $names = $names | append (index site.Params.authors .).name }}
{{ else }} {{ else }}

@ -1,7 +1,8 @@
{{ $page := .page }} {{ $params := . }}
{{ $url := .url }}
{{ $page := $params.page }}
{{ $resource := "" }} {{ $resource := "" }}
{{ $url := $params.url }}
{{ with $page.Resources.GetMatch $url }} {{ with $page.Resources.GetMatch $url }}
{{ $resource = . }} {{ $resource = . }}

@ -1,17 +1,19 @@
{{ $pagetitle := .Title | markdownify | plainify | htmlUnescape }} {{ $page := . }}
{{ $sitetitle := .Site.Title | markdownify | plainify | htmlUnescape }}
{{ $title := "" }}
{{ if and .Title .Site.Title }} {{ $pagetitle := $page.Title | markdownify | plainify | htmlUnescape }}
{{ $result := "" }}
{{ $sitetitle := site.Title | markdownify | plainify | htmlUnescape }}
{{ if and $pagetitle $sitetitle }}
{{ if .IsHome }} {{ if .IsHome }}
{{ $title = $pagetitle }} {{ $result = $pagetitle }}
{{ else }} {{ else }}
{{ $title = printf "%s · %s" $pagetitle $sitetitle }} {{ $result = printf "%s · %s" $pagetitle $sitetitle }}
{{ end }} {{ end }}
{{ else if .Title }} {{ else if $pagetitle }}
{{ $title = $pagetitle }} {{ $result = $pagetitle }}
{{ else if .Site.Title }} {{ else if $sitetitle }}
{{ $title = $sitetitle }} {{ $result = $sitetitle }}
{{ end }} {{ end }}
{{ return $title }} {{ return $result }}

@ -1,12 +1,14 @@
{{ $page := . }}
<head> <head>
{{ if templates.Exists "partials/paige/head-first.html" }} {{ if templates.Exists "partials/paige/head-first.html" }}
{{ partial "paige/head-first.html" . }} {{ partial "paige/head-first.html" $page }}
{{ end }} {{ end }}
{{ partial "paige/metas.html" . }} {{ partial "paige/metas.html" $page }}
<title>{{ partial "paige/func-title.html" . }}</title> <title>{{ partial "paige/func-title.html" $page }}</title>
{{ partial "paige/links.html" . }} {{ partial "paige/links.html" $page }}
{{ partial "paige/style.html" . }} {{ partial "paige/style.html" $page }}
{{ if templates.Exists "partials/paige/head-last.html" }} {{ if templates.Exists "partials/paige/head-last.html" }}
{{ partial "paige/head-last.html" . }} {{ partial "paige/head-last.html" $page }}
{{ end }} {{ end }}
</head> </head>

@ -1,3 +1,5 @@
{{ $page := . }}
{{ $first := templates.Exists "partials/paige/header-first.html" }} {{ $first := templates.Exists "partials/paige/header-first.html" }}
{{ $last := templates.Exists "partials/paige/header-last.html" }} {{ $last := templates.Exists "partials/paige/header-last.html" }}
{{ $menu := site.Menus.main }} {{ $menu := site.Menus.main }}
@ -5,13 +7,13 @@
{{ if or $first $last $menu }} {{ if or $first $last $menu }}
<header> <header>
{{ if $first }} {{ if $first }}
{{ partial "paige/header-first.html" . }} {{ partial "paige/header-first.html" $page }}
{{ end }} {{ end }}
{{ if $menu }} {{ if $menu }}
{{ partial "paige/menu.html" . }} {{ partial "paige/menu.html" $page }}
{{ end }} {{ end }}
{{ if $last }} {{ if $last }}
{{ partial "paige/header-last.html" . }} {{ partial "paige/header-last.html" $page }}
{{ end }} {{ end }}
</header> </header>
{{ end }} {{ end }}

@ -1,23 +1,25 @@
{{ $alt := .alt }} {{ $params := . }}
{{ $caption := .caption }}
{{ $compact := .compact }} {{ $alt := $params.alt }}
{{ $float := .float }} {{ $caption := $params.caption }}
{{ $height := .height }} {{ $compact := $params.compact }}
{{ $horizontal := .horizontal }} {{ $float := $params.float }}
{{ $link := .link }} {{ $height := $params.height }}
{{ $maxheight := .maxheight }} {{ $horizontal := $params.horizontal }}
{{ $maxwidth := .maxwidth }} {{ $link := $params.link }}
{{ $method := .method }} {{ $maxheight := $params.maxheight }}
{{ $number := .number }} {{ $maxwidth := $params.maxwidth }}
{{ $numbered := .numbered }} {{ $method := $params.method }}
{{ $options := .options }} {{ $number := $params.number }}
{{ $page := .page }} {{ $numbered := $params.numbered }}
{{ $raw := .raw }} {{ $options := $params.options }}
{{ $resource := .resource }} {{ $page := $params.page }}
{{ $src := .src }} {{ $raw := $params.raw }}
{{ $title := .title }} {{ $resource := $params.resource }}
{{ $vertical := .vertical }} {{ $src := $params.src }}
{{ $width := .width }} {{ $title := $params.title }}
{{ $vertical := $params.vertical }}
{{ $width := $params.width }}
{{ $content := partial "paige/img.html" (dict {{ $content := partial "paige/img.html" (dict
"alt" $alt "alt" $alt

@ -1,22 +1,24 @@
{{ $alt := .alt }} {{ $params := . }}
{{ $class := .class }}
{{ $crossorigin := .crossorigin | default "anonymous" }} {{ $alt := $params.alt }}
{{ $fetchpriority := .fetchpriority }} {{ $class := $params.class }}
{{ $fingerprint := .fingerprint | default true }} {{ $crossorigin := $params.crossorigin | default "anonymous" }}
{{ $height := .height }} {{ $fetchpriority := $params.fetchpriority }}
{{ $loading := .loading | default "lazy" }} {{ $fingerprint := $params.fingerprint | default true }}
{{ $maxheight := .maxheight }} {{ $height := $params.height }}
{{ $maxwidth := .maxwidth }} {{ $loading := $params.loading | default "lazy" }}
{{ $method := .method }} {{ $maxheight := $params.maxheight }}
{{ $options := .options }} {{ $maxwidth := $params.maxwidth }}
{{ $page := .page }} {{ $method := $params.method }}
{{ $raw := .raw }} {{ $options := $params.options }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }} {{ $page := $params.page }}
{{ $resource := .resource }} {{ $raw := $params.raw }}
{{ $src := .src }} {{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $style := .style }} {{ $resource := $params.resource }}
{{ $title := .title }} {{ $src := $params.src }}
{{ $width := .width }} {{ $style := $params.style }}
{{ $title := $params.title }}
{{ $width := $params.width }}
{{ $intrinsicheight := $height }} {{ $intrinsicheight := $height }}
{{ $intrinsicwidth := $width }} {{ $intrinsicwidth := $width }}

@ -1,9 +1,11 @@
{{ $crossorigin := .crossorigin | default "anonymous" }} {{ $params := . }}
{{ $href := .href }}
{{ $integrity := .integrity }} {{ $crossorigin := $params.crossorigin | default "anonymous" }}
{{ $page := .page }} {{ $href := $params.href }}
{{ $raw := .raw }} {{ $integrity := $params.integrity }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }} {{ $page := $params.page }}
{{ $raw := $params.raw }}
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ if $raw }} {{ if $raw }}
{{ $href = relLangURL $href }} {{ $href = relLangURL $href }}

@ -1,3 +1,5 @@
{{ $page := . }}
<link href="{{ relLangURL `apple-touch-icon.png` | safeURL }}" rel="apple-touch-icon" sizes="180x180"> <link href="{{ relLangURL `apple-touch-icon.png` | safeURL }}" rel="apple-touch-icon" sizes="180x180">
<link href="{{ relLangURL `favicon-16x16.png` | safeURL }}" rel="icon" sizes="16x16" type="image/png"> <link href="{{ relLangURL `favicon-16x16.png` | safeURL }}" rel="icon" sizes="16x16" type="image/png">
<link href="{{ relLangURL `favicon-32x32.png` | safeURL }}" rel="icon" sizes="32x32" type="image/png"> <link href="{{ relLangURL `favicon-32x32.png` | safeURL }}" rel="icon" sizes="32x32" type="image/png">
@ -18,7 +20,7 @@
"integrity" site.Params.paige.bootstrap.style.link_integrity "integrity" site.Params.paige.bootstrap.style.link_integrity
"raw" site.Params.paige.bootstrap.style.raw "raw" site.Params.paige.bootstrap.style.raw
) }} ) }}
{{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }} {{ if or $page.Params.paige.math (and $page.Params.paige.show_full_pages (where $page.Pages "Params.paige.math" "eq" true)) }}
{{ partial "paige/link.html" (dict {{ partial "paige/link.html" (dict
"href" (site.Params.paige.math.style.link_href | default "https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.css") "href" (site.Params.paige.math.style.link_href | default "https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.css")
"integrity" (site.Params.paige.math.style.link_integrity | default "sha256-NJNVfEC6jfEt62wQMafLNT2eI6BaWONXbpkSEVAs3+8=") "integrity" (site.Params.paige.math.style.link_integrity | default "sha256-NJNVfEC6jfEt62wQMafLNT2eI6BaWONXbpkSEVAs3+8=")
@ -26,7 +28,7 @@
) }} ) }}
{{ end }} {{ end }}
{{ if .AlternativeOutputFormats }} {{ if .AlternativeOutputFormats }}
{{ $title := partial "paige/func-title.html" . }} {{ $title := partial "paige/func-title.html" $page }}
{{ range .AlternativeOutputFormats }} {{ range .AlternativeOutputFormats }}
<link href="{{ .Permalink | safeURL }}" rel="{{ .Rel }}" title="{{ $title }}" type="{{ .MediaType.Type }}"> <link href="{{ .Permalink | safeURL }}" rel="{{ .Rel }}" title="{{ $title }}" type="{{ .MediaType.Type }}">
{{ end }} {{ end }}

@ -1,5 +1,7 @@
{{ $page := . }}
<section class="paige-metadata w-100"> <section class="paige-metadata w-100">
{{ partial "paige/title.html" . }} {{ partial "paige/title.html" $page }}
{{ partial "paige/description.html" . }} {{ partial "paige/description.html" $page }}
{{ partial "paige/about.html" . }} {{ partial "paige/about.html" $page }}
</section> </section>

@ -1,11 +1,13 @@
{{ $page := . }}
<meta charset="utf-8"> <meta charset="utf-8">
{{ with partial "paige/func-authors.html" . }} {{ with partial "paige/func-authors.html" $page }}
<meta content="{{ . }}" name="author"> <meta content="{{ . }}" name="author">
{{ end }} {{ end }}
{{ with .Description }} {{ with $page.Description }}
<meta content="{{ . }}" name="description"> <meta content="{{ . }}" name="description">
{{ end }} {{ end }}
{{ if or .Keywords .Params.tags .Params.categories }} {{ if or $page.Keywords $page.Params.tags $page.Params.categories }}
<meta content="{{ delimit (sort (union (union .Keywords .Params.tags) .Params.categories)) `, ` }}" name="keywords"> <meta content="{{ delimit (sort (union (union .Keywords .Params.tags) .Params.categories)) `, ` }}" name="keywords">
{{ end }} {{ end }}
<meta content="{{ site.Params.paige.color | default `#0d6efd` }}" name="msapplication-TileColor"> <meta content="{{ site.Params.paige.color | default `#0d6efd` }}" name="msapplication-TileColor">
@ -14,5 +16,5 @@
{{ end }} {{ end }}
<meta content="{{ site.Params.paige.color | default `#0d6efd` }}" name="theme-color"> <meta content="{{ site.Params.paige.color | default `#0d6efd` }}" name="theme-color">
<meta content="width=device-width, initial-scale=1" name="viewport"> <meta content="width=device-width, initial-scale=1" name="viewport">
{{ template "_internal/opengraph.html" . }} {{ template "_internal/opengraph.html" $page }}
{{ template "_internal/twitter_cards.html" . }} {{ template "_internal/twitter_cards.html" $page }}

@ -1,41 +1,43 @@
{{ if .Pages }} {{ $page := . }}
{{ if .Params.paige.show_full_pages }}
{{ $p := .Paginate .Pages }} {{ if $page.Pages }}
{{ if $page.Params.paige.show_full_pages }}
{{ $p := $page.Paginate $page.Pages }}
<section> <section>
{{ range $p.Pages }} {{ range $p.Pages }}
{{ .Scratch.Set "paige_show_full_pages" true }} {{ $page.Scratch.Set "paige_show_full_pages" true }}
{{ partial "paige/article.html" . }} {{ partial "paige/article.html" $page }}
{{ end }} {{ end }}
</section> </section>
{{ if or $p.HasPrev $p.HasNext }} {{ if or $p.HasPrev $p.HasNext }}
<section> <section>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
{{ partial "paige/pagination.html" . }} {{ partial "paige/pagination.html" $page }}
</div> </div>
</section> </section>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ $p := .Paginate (.Pages.ByDate.Reverse.GroupByDate "January 2006") }} {{ $p := $page.Paginate ($page.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
<section> <section>
{{ range $p.PageGroups }} {{ range $p.PageGroups }}
{{ if $.Param "paige.page_list.date_header.hide" | not }} {{ if $page.Param "paige.page_list.date_header.hide" | not }}
<h2 class="{{ $.Param `paige.page_list.date_header.class` | default `h5 text-center` }}">{{ .Key }}</h2> <h2 class="{{ $.Param `paige.page_list.date_header.class` | default `h5 text-center` }}">{{ .Key }}</h2>
{{ end }} {{ end }}
{{ range .Pages }} {{ range .Pages }}
{{ $class := "text-center" }} {{ $class := "text-center" }}
{{ $authors := cond ($.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }} {{ $authors := cond ($page.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }}
{{ $authorsclass := $.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }} {{ $authorsclass := $page.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }}
{{ $date := cond ($.Param "paige.page_list.date.show" | not) "" .PublishDate }} {{ $date := cond ($page.Param "paige.page_list.date.show" | not) "" .PublishDate }}
{{ $dateclass := $.Param "paige.page_list.date.class" | default (print $class " text-secondary") }} {{ $dateclass := $page.Param "paige.page_list.date.class" | default (print $class " text-secondary") }}
{{ $description := cond ($.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }} {{ $description := cond ($page.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }}
{{ $descriptionclass := $.Param "paige.page_list.description.class" | default $class }} {{ $descriptionclass := $page.Param "paige.page_list.description.class" | default $class }}
{{ $flags := slice }} {{ $flags := slice }}
{{ $gap := "mb-0" }} {{ $gap := "mb-0" }}
{{ $summary := cond ($.Param "paige.page_list.summary.show" | not) "" (.Summary | strings.TrimPrefix "<p>" | strings.TrimSuffix "</p>") }} {{ $summary := cond ($page.Param "paige.page_list.summary.show" | not) "" (.Summary | strings.TrimPrefix "<p>" | strings.TrimSuffix "</p>") }}
{{ $summaryclass := $.Param "paige.page_list.summary.class" | default $class }} {{ $summaryclass := $page.Param "paige.page_list.summary.class" | default $class }}
{{ $title := cond ($.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }} {{ $title := cond ($page.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
{{ $titleclass := $.Param "paige.page_list.title_class" | default $class }} {{ $titleclass := $page.Param "paige.page_list.title.class" | default $class }}
{{ if .Draft }} {{ if .Draft }}
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }} {{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
@ -78,7 +80,7 @@
{{ if or $p.HasPrev $p.HasNext }} {{ if or $p.HasPrev $p.HasNext }}
<section> <section>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
{{ partial "paige/pagination.html" . }} {{ partial "paige/pagination.html" $page }}
</div> </div>
</section> </section>
{{ end }} {{ end }}

@ -1,11 +1,13 @@
{{ $crossorigin := .crossorigin | default "anonymous" }} {{ $params := . }}
{{ $defer := .defer | default "defer" }}
{{ $integrity := .integrity }} {{ $crossorigin := $params.crossorigin | default "anonymous" }}
{{ $onload := .onload | safeJS }} {{ $defer := $params.defer | default "defer" }}
{{ $page := .page }} {{ $integrity := $params.integrity }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }} {{ $onload := $params.onload | safeJS }}
{{ $raw := .raw }} {{ $page := $params.page }}
{{ $src := .src }} {{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
{{ $raw := $params.raw }}
{{ $src := $params.src }}
{{ if $raw }} {{ if $raw }}
{{ $src = relLangURL $src }} {{ $src = relLangURL $src }}

@ -1,3 +1,5 @@
{{ $page := . }}
<section> <section>
<div class="container-fluid"> <div class="container-fluid">
<form action="{{ .Page.RelPermalink }}" dir="auto" method="get"> <form action="{{ .Page.RelPermalink }}" dir="auto" method="get">
@ -87,7 +89,7 @@ function paigeSearch(queryText) {
var done = {}; var done = {};
results.forEach(function (result) { results.forEach(function (result) {
result.result.forEach(function (path) { result.result.forEach(function (path) {
if (path === "{{ .RelPermalink }}" || done[path]) { if (path === "{{ $page.RelPermalink }}" || done[path]) {
return; return;
} }
if (!shown) { if (!shown) {

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

@ -1,7 +1,9 @@
{{ if and .Content .Params.paige.toc (not (eq (.Scratch.Get "paige_show_full_pages") true)) (ne .TableOfContents `<nav id="TableOfContents"></nav>`) }} {{ $page := . }}
{{ if and $page.Content $page.Params.paige.toc (not (eq ($page.Scratch.Get "paige_show_full_pages") true)) (ne $page.TableOfContents `<nav id="TableOfContents"></nav>`) }}
<section class="paige-toc"> <section class="paige-toc">
<div class="border mb-3 pe-3 ps-3 pt-3 rounded"> <div class="border mb-3 pe-3 ps-3 pt-3 rounded">
{{ .TableOfContents }} {{ $page.TableOfContents }}
</div> </div>
</section> </section>
{{ end }} {{ end }}

Loading…
Cancel
Save