Use with where possible

This commit is contained in:
Will Faught
2022-12-13 22:08:04 -08:00
parent e0ddce45e4
commit ff587e94e0
10 changed files with 31 additions and 31 deletions

View File

@@ -1,3 +1,3 @@
{{ if .Content }}
{{ .Content | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` `${1}<a class="headerlink" href="#${2}"><i class="bi bi-link-45deg small"></i></a>${3}` | safeHTML }}
{{ with .Content }}
{{ . | replaceRE `(<h[1-9] id="([^"]+)".+)(</h[1-9]+>)` `${1}<a class="headerlink" href="#${2}"><i class="bi bi-link-45deg small"></i></a>${3}` | safeHTML }}
{{ end }}

View File

@@ -1,3 +1,3 @@
{{ if .PublishDate }}
<p class="text-center text-muted"><time datetime="{{ .PublishDate.Format `2006-01-02` }}">{{ .PublishDate.Format "January 2, 2006" }}</time></p>
{{ with .PublishDate }}
<p class="text-center text-muted"><time datetime="{{ .Format `2006-01-02` }}">{{ .Format "January 2, 2006" }}</time></p>
{{ end }}

View File

@@ -1,3 +1,3 @@
{{ if .Description }}
<p class="lead text-center">{{ .Description | markdownify }}</p>
{{ with .Description }}
<p class="lead text-center">{{ . | markdownify }}</p>
{{ end }}

View File

@@ -1,10 +1,10 @@
{{ if .Site.Params.paigebootstrapcss }}
<link href="{{ relURL .Site.Params.paigebootstrapcss }}" rel="stylesheet">
{{ with .Site.Params.paigebootstrapcss }}
<link href="{{ relURL . }}" rel="stylesheet">
{{ else }}
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" rel="stylesheet">
{{ end }}
{{ if .Site.Params.paigebootstrapicons }}
<link href="{{ relURL .Site.Params.paigebootstrapicons }}" rel="stylesheet">
{{ with .Site.Params.paigebootstrapicons }}
<link href="{{ relURL . }}" rel="stylesheet">
{{ else }}
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css" integrity="sha384-b6lVK+yci+bfDmaY1u0zE8YYJt0TZxLEAFyYSLHId4xoVvsrQu3INevFKo+Xir8e" rel="stylesheet">
{{ end }}

View File

@@ -1,9 +1,9 @@
<meta charset="utf-8">
{{ if .Site.Author.name }}
<meta content="{{ .Site.Author.name }}" name="author">
{{ with .Site.Author.name }}
<meta content="{{ . }}" name="author">
{{ end }}
{{ if .Description }}
<meta content="{{ .Description }}" name="description">
{{ with .Description }}
<meta content="{{ . }}" name="description">
{{ end }}
{{ if or .Keywords .Params.tags .Params.categories }}
<meta content="{{ delimit (sort (union (union .Keywords .Params.tags) .Params.categories)) `, ` }}" name="keywords">

View File

@@ -6,15 +6,15 @@
{{ range .Pages }}
<p class="text-center">
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
{{ if .Description }}
{{ with .Description }}
<br>
{{ .Description | markdownify }}
{{ . | markdownify }}
{{ end }}
</p>
{{ end }}
{{ end }}
{{ if or $p.HasPrev $p.HasNext }}
<div class="d-flex justify-content-center pt-3">
<div class="d-flex justify-content-center">
{{ partial "paige-pagination.html" . }}
</div>
{{ end }}

View File

@@ -1,5 +1,5 @@
{{ if .Site.Params.paigebootstrapjs }}
<script defer src="{{ relURL .Site.Params.paigebootstrapjs }}"></script>
{{ with .Site.Params.paigebootstrapjs }}
<script defer src="{{ relURL . }}"></script>
{{ else }}
<script crossorigin="anonymous" defer integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" referrerpolicy="no-referrer" src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"></script>
{{ end }}

View File

@@ -1,7 +1,7 @@
{{ if .Site.Social }}
{{ with .Site.Social }}
<section>
<div class="pb-3 text-center">
{{ range $k, $v := .Site.Social }}
{{ range $k, $v := . }}
<a href="{{ $v }}"><i class="bi bi-{{ $k }} display-6 px-2"></i></a>
{{ end }}
</div>

View File

@@ -8,8 +8,8 @@
{{ end }}
{{ if $title }}
<h1 class="{{ $class }} fw-bold text-center">
{{ if .Params.link }}
<a href="{{ .Params.link }}">{{ $title | markdownify }}</a>
{{ with .Params.link }}
<a href="{{ . }}">{{ $title | markdownify }}</a>
{{ else }}
{{ $title | markdownify }}
{{ end }}