Assign template context to var
parent
548af63634
commit
64e148ab6f
@ -1,35 +1,37 @@
|
||||
{{ $page := . }}
|
||||
|
||||
<!doctype html>
|
||||
{{ $rtl := eq .Language.LanguageDirection "rtl" }}
|
||||
{{ $lang := .Site.LanguageCode | default .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 }}>
|
||||
{{ partial "paige/head.html" . }}
|
||||
{{ partial "paige/body.html" . }}
|
||||
{{ $rtl := eq $page.Language.LanguageDirection "rtl" }}
|
||||
{{ $lang := $page.Site.LanguageCode | default $page.Site.Language.Lang }}
|
||||
<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" $page }}
|
||||
{{ partial "paige/body.html" $page }}
|
||||
{{ if templates.Exists "partials/paige/body-first.html" }}
|
||||
{{ partial "paige/body-first.html" . }}
|
||||
{{ partial "paige/body-first.html" $page }}
|
||||
{{ end }}
|
||||
<div class="container flex-fill">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{{ partial "paige/header.html" . }}
|
||||
{{ partial "paige/header.html" $page }}
|
||||
<main>
|
||||
{{ if templates.Exists "partials/paige/main-first.html" }}
|
||||
{{ partial "paige/main-first.html" . }}
|
||||
{{ partial "paige/main-first.html" $page }}
|
||||
{{ end }}
|
||||
{{ block "main" . }}{{ end }}
|
||||
{{ block "main" $page }}{{ end }}
|
||||
{{ if templates.Exists "partials/paige/main-last.html" }}
|
||||
{{ partial "paige/main-last.html" . }}
|
||||
{{ partial "paige/main-last.html" $page }}
|
||||
{{ end }}
|
||||
</main>
|
||||
{{ partial "paige/footer.html" . }}
|
||||
{{ partial "paige/footer.html" $page }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ partial "paige/scripts.html" . }}
|
||||
{{ partial "paige/scripts.html" $page }}
|
||||
{{ if templates.Exists "partials/paige/body-last.html" }}
|
||||
{{ partial "paige/body-last.html" . }}
|
||||
{{ partial "paige/body-last.html" $page }}
|
||||
{{ end }}
|
||||
</body>
|
||||
</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 }}
|
||||
{{ end }}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ if not .Params.paige.show_full_pages }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ partial "paige/article.html" $page }}
|
||||
{{ end }}
|
||||
{{ partial "paige/pages.html" . }}
|
||||
{{ partial "paige/pages.html" $page }}
|
||||
{{ end }}
|
||||
|
@ -1,4 +1,6 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ partial "paige/comments.html" . }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ partial "paige/article.html" $page }}
|
||||
{{ partial "paige/comments.html" $page }}
|
||||
{{ end }}
|
||||
|
@ -1,4 +1,6 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ partial "paige/pages.html" . }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ partial "paige/article.html" $page }}
|
||||
{{ partial "paige/pages.html" $page }}
|
||||
{{ end }}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{{ $class := .class }}
|
||||
{{ $content := .content }}
|
||||
{{ $href := .href }}
|
||||
{{ $style := .style }}
|
||||
{{ $params := . }}
|
||||
|
||||
{{ $class := $params.class }}
|
||||
{{ $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>
|
||||
|
@ -1,14 +1,16 @@
|
||||
{{ $authors := cond (.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" .) "" }}
|
||||
{{ $authorsclass := .Param "paige.page.authors.class" | default "text-center text-secondary" }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $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" }}
|
||||
{{ $date := cond (.Param "paige.page.date.hide" | not) .PublishDate "" }}
|
||||
{{ $dateclass := .Param "paige.page.date.class" | default "text-center text-secondary" }}
|
||||
{{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }}
|
||||
{{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }}
|
||||
|
||||
{{ with $authors }}
|
||||
<p class="{{ if $date }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
{{ end }}
|
||||
{{ if $date }}
|
||||
{{ with $date }}
|
||||
<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>
|
||||
{{ end }}
|
||||
|
@ -1,7 +1,9 @@
|
||||
{{ $page := . }}
|
||||
|
||||
<article>
|
||||
<div class="align-items-center d-flex flex-column mb-0">
|
||||
{{ partial "paige/metadata.html" . }}
|
||||
{{ partial "paige/toc.html" . }}
|
||||
{{ partial "paige/content.html" . }}
|
||||
{{ partial "paige/metadata.html" $page }}
|
||||
{{ partial "paige/toc.html" $page }}
|
||||
{{ partial "paige/content.html" $page }}
|
||||
</div>
|
||||
</article>
|
||||
|
@ -1,17 +1,19 @@
|
||||
{{ $pagetitle := .Title | markdownify | plainify | htmlUnescape }}
|
||||
{{ $sitetitle := .Site.Title | markdownify | plainify | htmlUnescape }}
|
||||
{{ $title := "" }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ if and .Title .Site.Title }}
|
||||
{{ $pagetitle := $page.Title | markdownify | plainify | htmlUnescape }}
|
||||
{{ $result := "" }}
|
||||
{{ $sitetitle := site.Title | markdownify | plainify | htmlUnescape }}
|
||||
|
||||
{{ if and $pagetitle $sitetitle }}
|
||||
{{ if .IsHome }}
|
||||
{{ $title = $pagetitle }}
|
||||
{{ $result = $pagetitle }}
|
||||
{{ else }}
|
||||
{{ $title = printf "%s · %s" $pagetitle $sitetitle }}
|
||||
{{ $result = printf "%s · %s" $pagetitle $sitetitle }}
|
||||
{{ end }}
|
||||
{{ else if .Title }}
|
||||
{{ $title = $pagetitle }}
|
||||
{{ else if .Site.Title }}
|
||||
{{ $title = $sitetitle }}
|
||||
{{ else if $pagetitle }}
|
||||
{{ $result = $pagetitle }}
|
||||
{{ else if $sitetitle }}
|
||||
{{ $result = $sitetitle }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $title }}
|
||||
{{ return $result }}
|
||||
|
@ -1,12 +1,14 @@
|
||||
{{ $page := . }}
|
||||
|
||||
<head>
|
||||
{{ if templates.Exists "partials/paige/head-first.html" }}
|
||||
{{ partial "paige/head-first.html" . }}
|
||||
{{ partial "paige/head-first.html" $page }}
|
||||
{{ end }}
|
||||
{{ partial "paige/metas.html" . }}
|
||||
<title>{{ partial "paige/func-title.html" . }}</title>
|
||||
{{ partial "paige/links.html" . }}
|
||||
{{ partial "paige/style.html" . }}
|
||||
{{ partial "paige/metas.html" $page }}
|
||||
<title>{{ partial "paige/func-title.html" $page }}</title>
|
||||
{{ partial "paige/links.html" $page }}
|
||||
{{ partial "paige/style.html" $page }}
|
||||
{{ if templates.Exists "partials/paige/head-last.html" }}
|
||||
{{ partial "paige/head-last.html" . }}
|
||||
{{ partial "paige/head-last.html" $page }}
|
||||
{{ end }}
|
||||
</head>
|
||||
|
@ -1,5 +1,7 @@
|
||||
{{ $page := . }}
|
||||
|
||||
<section class="paige-metadata w-100">
|
||||
{{ partial "paige/title.html" . }}
|
||||
{{ partial "paige/description.html" . }}
|
||||
{{ partial "paige/about.html" . }}
|
||||
{{ partial "paige/title.html" $page }}
|
||||
{{ partial "paige/description.html" $page }}
|
||||
{{ partial "paige/about.html" $page }}
|
||||
</section>
|
||||
|
@ -1,6 +1,8 @@
|
||||
{{ $class := .Param "paige.page.title.class" | default "display-5 fw-bold text-center" }}
|
||||
{{ $title := cond (.Param "paige.page.title.hide" | not) (.Title | markdownify) "" }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $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 }}
|
||||
<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 }}
|
||||
|
@ -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">
|
||||
<div class="border mb-3 pe-3 ps-3 pt-3 rounded">
|
||||
{{ .TableOfContents }}
|
||||
{{ $page.TableOfContents }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue