Assign template context to var
This commit is contained in:
@@ -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,14 +1,16 @@
|
||||
{{ define "main" }}
|
||||
{{ $page := . }}
|
||||
|
||||
<article>
|
||||
{{ partial "paige/metadata.html" . }}
|
||||
{{ partial "paige/metadata.html" $page }}
|
||||
<section>
|
||||
{{ if .Params.image_url }}
|
||||
{{ if $page.Params.image_url }}
|
||||
{{ $class := "mw-100 rounded-4 shadow" }}
|
||||
{{ if .Params.image_stretch }}
|
||||
{{ if $page.Params.image_stretch }}
|
||||
{{ $class = "rounded-4 shadow w-100" }}
|
||||
{{ end }}
|
||||
{{ $style := "height: 20rem" }}
|
||||
{{ if .Params.image_stretch }}
|
||||
{{ if $page.Params.image_stretch }}
|
||||
{{ $style = "height: 20rem; object-fit: cover" }}
|
||||
{{ end }}
|
||||
<p {{ if not .Params.image_stretch }} class="text-center" {{ end }}>
|
||||
@@ -22,10 +24,10 @@
|
||||
) }}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ with .Params.greeting }}
|
||||
{{ with $page.Params.greeting }}
|
||||
<p class="display-5 fw-bold h2 text-center">{{ . | markdownify }}</p>
|
||||
{{ end }}
|
||||
{{ with .Params.blurb }}
|
||||
{{ with $page.Params.blurb }}
|
||||
<div class="container-fluid">
|
||||
<div class="justify-content-center row">
|
||||
<div class="col col-auto col-lg-7 px-0">
|
||||
@@ -35,8 +37,8 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "paige/toc.html" . }}
|
||||
{{ partial "paige/content.html" . }}
|
||||
{{ partial "paige/social.html" . }}
|
||||
{{ partial "paige/toc.html" $page }}
|
||||
{{ partial "paige/content.html" $page }}
|
||||
{{ partial "paige/social.html" $page }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
{{- $.Scratch.Add "index" slice -}}
|
||||
{{- range where .Site.RegularPages "Params.paige.hide_search" "ne" true -}}
|
||||
{{- $.Scratch.Add "index" (dict
|
||||
{{- $page := . -}}
|
||||
|
||||
{{- $page.Scratch.Add "index" slice -}}
|
||||
{{- range where $page.Site.RegularPages "Params.paige.hide_search" "ne" true -}}
|
||||
{{- $page.Scratch.Add "index" (dict
|
||||
"categories" .Params.categories
|
||||
"date" .PublishDate
|
||||
"description" (.Description | markdownify | plainify | htmlUnescape)
|
||||
@@ -10,4 +12,4 @@
|
||||
"text" (strings.TrimRight " " (replace (.Plain | htmlUnescape) "\n" " "))
|
||||
"title" (.Title | markdownify | plainify | htmlUnescape)) -}}
|
||||
{{- end -}}
|
||||
{{- $.Scratch.Get "index" | jsonify -}}
|
||||
{{- $page.Scratch.Get "index" | jsonify -}}
|
||||
|
@@ -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,43 +1,45 @@
|
||||
{{ $item := . }}
|
||||
{{ if .IsHome }}
|
||||
{{ $item = .Site }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $item := $page }}
|
||||
{{ if $page.IsHome }}
|
||||
{{ $item = $page.Site }}
|
||||
{{ end }}
|
||||
{{ $pages := slice }}
|
||||
{{ if or $.IsHome $.IsSection }}
|
||||
{{ if or $page.IsHome $page.IsSection }}
|
||||
{{ $pages = $item.RegularPages }}
|
||||
{{ else }}
|
||||
{{ $pages = $item.Pages }}
|
||||
{{ end }}
|
||||
{{ $limit := .Site.Config.Services.RSS.Limit }}
|
||||
{{ $limit := $page.Site.Config.Services.RSS.Limit }}
|
||||
{{ if ge $limit 1 }}
|
||||
{{ $pages = $pages | first $limit }}
|
||||
{{ end }}
|
||||
{{ $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 }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ with $page.OutputFormats.Get "RSS" }}
|
||||
{{ printf `<atom:link href="%s" rel="self" type="%s"/>` .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ with .Site.Copyright }}
|
||||
{{ with $page.Site.Copyright }}
|
||||
<copyright>{{ . }}</copyright>
|
||||
{{ end }}
|
||||
<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>
|
||||
{{ end }}
|
||||
{{ if and .Date (not .Date.IsZero) }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
|
||||
{{ if and $page.Date (not $page.Date.IsZero) }}
|
||||
<lastBuildDate>{{ $page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
|
||||
{{ end }}
|
||||
<link>{{ .Permalink }}</link>
|
||||
{{ with .Site.Params.paige.rss.managing_editor }}
|
||||
<link>{{ $page.Permalink }}</link>
|
||||
{{ with $page.Site.Params.paige.rss.managing_editor }}
|
||||
<managingEditor>{{ . }}</managingEditor>
|
||||
{{ end }}
|
||||
{{ with $title }}
|
||||
<title>{{ . }}</title>
|
||||
{{ end }}
|
||||
{{ with .Site.Params.paige.rss.web_master }}
|
||||
{{ with $page.Site.Params.paige.rss.web_master }}
|
||||
<webMaster>{{ . }}</webMaster>
|
||||
{{ end }}
|
||||
{{ range $pages }}
|
||||
|
@@ -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,9 +1,11 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "paige/article.html" . }}
|
||||
{{ if .Pages }}
|
||||
{{ $page := . }}
|
||||
|
||||
{{ partial "paige/article.html" $page }}
|
||||
{{ if $page.Pages }}
|
||||
<section>
|
||||
<ul class="list-inline text-center">
|
||||
{{ range (sort .Pages "Title") }}
|
||||
{{ range (sort $page.Pages "Title") }}
|
||||
<li class="list-inline-item">
|
||||
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
|
||||
</li>
|
||||
|
@@ -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 }}
|
||||
|
Reference in New Issue
Block a user