From ff587e94e0f8dad2527e74a007dae1e8798e344a Mon Sep 17 00:00:00 2001 From: Will Faught Date: Tue, 13 Dec 2022 22:08:04 -0800 Subject: [PATCH] Use with where possible --- layouts/_default/home.html | 16 ++++++++-------- layouts/partials/paige-content.html | 4 ++-- layouts/partials/paige-date.html | 4 ++-- layouts/partials/paige-description.html | 4 ++-- layouts/partials/paige-link.html | 8 ++++---- layouts/partials/paige-meta.html | 8 ++++---- layouts/partials/paige-pages.html | 6 +++--- layouts/partials/paige-script.html | 4 ++-- layouts/partials/paige-social.html | 4 ++-- layouts/partials/paige-title.html | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/layouts/_default/home.html b/layouts/_default/home.html index b37e4d14..03b6e77a 100644 --- a/layouts/_default/home.html +++ b/layouts/_default/home.html @@ -2,21 +2,21 @@ {{ partial "paige-title.html" . }} {{ partial "paige-description.html" . }} {{ partial "paige-date.html" . }} -{{ if .Params.stretch }} -
+{{ with .Params.stretch }} +
{{ end }} -{{ if .Params.center }} +{{ with .Params.center }}

- +

{{ end }} -{{ if .Params.greeting }} -

{{ .Params.greeting | markdownify }}

+{{ with .Params.greeting }} +

{{ . | markdownify }}

{{ end }} -{{ if .Params.blurb }} +{{ with .Params.blurb }}
-

{{ .Params.blurb | markdownify }}

+

{{ . | markdownify }}

{{ end }} diff --git a/layouts/partials/paige-content.html b/layouts/partials/paige-content.html index 7a811713..b49e46c2 100644 --- a/layouts/partials/paige-content.html +++ b/layouts/partials/paige-content.html @@ -1,3 +1,3 @@ -{{ if .Content }} -{{ .Content | replaceRE `()` `${1}${3}` | safeHTML }} +{{ with .Content }} +{{ . | replaceRE `()` `${1}${3}` | safeHTML }} {{ end }} diff --git a/layouts/partials/paige-date.html b/layouts/partials/paige-date.html index 5493682c..2a366ac3 100644 --- a/layouts/partials/paige-date.html +++ b/layouts/partials/paige-date.html @@ -1,3 +1,3 @@ -{{ if .PublishDate }} -

+{{ with .PublishDate }} +

{{ end }} diff --git a/layouts/partials/paige-description.html b/layouts/partials/paige-description.html index 30cb0701..d319e128 100644 --- a/layouts/partials/paige-description.html +++ b/layouts/partials/paige-description.html @@ -1,3 +1,3 @@ -{{ if .Description }} -

{{ .Description | markdownify }}

+{{ with .Description }} +

{{ . | markdownify }}

{{ end }} diff --git a/layouts/partials/paige-link.html b/layouts/partials/paige-link.html index 6cf76b67..84298fa9 100644 --- a/layouts/partials/paige-link.html +++ b/layouts/partials/paige-link.html @@ -1,10 +1,10 @@ -{{ if .Site.Params.paigebootstrapcss }} - +{{ with .Site.Params.paigebootstrapcss }} + {{ else }} {{ end }} -{{ if .Site.Params.paigebootstrapicons }} - +{{ with .Site.Params.paigebootstrapicons }} + {{ else }} {{ end }} diff --git a/layouts/partials/paige-meta.html b/layouts/partials/paige-meta.html index 9864c8bd..629b10a5 100644 --- a/layouts/partials/paige-meta.html +++ b/layouts/partials/paige-meta.html @@ -1,9 +1,9 @@ -{{ if .Site.Author.name }} - +{{ with .Site.Author.name }} + {{ end }} -{{ if .Description }} - +{{ with .Description }} + {{ end }} {{ if or .Keywords .Params.tags .Params.categories }} diff --git a/layouts/partials/paige-pages.html b/layouts/partials/paige-pages.html index 7b53ebcb..011150b9 100644 --- a/layouts/partials/paige-pages.html +++ b/layouts/partials/paige-pages.html @@ -6,15 +6,15 @@ {{ range .Pages }}

{{ .Title | markdownify }} - {{ if .Description }} + {{ with .Description }}
- {{ .Description | markdownify }} + {{ . | markdownify }} {{ end }}

{{ end }} {{ end }} {{ if or $p.HasPrev $p.HasNext }} -
+
{{ partial "paige-pagination.html" . }}
{{ end }} diff --git a/layouts/partials/paige-script.html b/layouts/partials/paige-script.html index 2364021b..83dc6845 100644 --- a/layouts/partials/paige-script.html +++ b/layouts/partials/paige-script.html @@ -1,5 +1,5 @@ -{{ if .Site.Params.paigebootstrapjs }} - +{{ with .Site.Params.paigebootstrapjs }} + {{ else }} {{ end }} diff --git a/layouts/partials/paige-social.html b/layouts/partials/paige-social.html index bdf0cbc2..0f6a7622 100644 --- a/layouts/partials/paige-social.html +++ b/layouts/partials/paige-social.html @@ -1,7 +1,7 @@ -{{ if .Site.Social }} +{{ with .Site.Social }}
- {{ range $k, $v := .Site.Social }} + {{ range $k, $v := . }} {{ end }}
diff --git a/layouts/partials/paige-title.html b/layouts/partials/paige-title.html index 65090c02..f42ad60d 100644 --- a/layouts/partials/paige-title.html +++ b/layouts/partials/paige-title.html @@ -8,8 +8,8 @@ {{ end }} {{ if $title }}

- {{ if .Params.link }} - {{ $title | markdownify }} + {{ with .Params.link }} + {{ $title | markdownify }} {{ else }} {{ $title | markdownify }} {{ end }}