Rewrite templates/partials for Hugo v0.146.0

This commit is contained in:
Ryan Gibson
2025-04-11 09:32:47 -04:00
parent 0d03681d20
commit baaf251bde
14 changed files with 28 additions and 28 deletions

View File

@@ -15,11 +15,11 @@
class="font-bold text-primary-600 ltr:pr-2 rtl:pl-2 dark:text-primary-400">&darr;</span>{{ i18n
"nav.skip_to_main" }}</a>
</div>
{{ $header := print "partials/header/" .Site.Params.header.layout ".html" }}
{{ if templates.Exists $header }}
{{ $header := print "header/" .Site.Params.header.layout ".html" }}
{{ if templates.Exists ( printf "partials/%s" $header ) }}
{{ partial $header . }}
{{ else }}
{{ partial "partials/header/basic.html" . }}
{{ partial "header/basic.html" . }}
{{ end }}
<div class="relative flex flex-col grow">
<main id="main-content" class="grow">

View File

@@ -2,11 +2,11 @@
{{ .Scratch.Set "scope" "list" }}
{{ if .Site.Params.list.showHero | default false }}
{{ $heroStyle := print "partials/hero/" .Site.Params.list.heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ $heroStyle := print "hero/" .Site.Params.list.heroStyle ".html" }}
{{ if templates.Exists ( printf "partials/%s" $heroStyle ) }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ partial "hero/basic.html" . }}
{{ end }}
{{- end -}}

View File

@@ -5,11 +5,11 @@
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
{{ $heroStyle := .Params.heroStyle }}
{{ if not $heroStyle }}{{ $heroStyle = .Site.Params.article.heroStyle }}{{ end }}
{{ $heroStyle := print "partials/hero/" $heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ $heroStyle := print "hero/" $heroStyle ".html" }}
{{ if templates.Exists ( printf "partials/%s" $heroStyle ) }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ partial "hero/basic.html" . }}
{{ end }}
{{ end }}
@@ -154,7 +154,7 @@
{{ partial "article-pagination.html" . }}
{{ if .Params.showComments | default (.Site.Params.article.showComments | default false) }}
{{ if templates.Exists "partials/comments.html" }}
{{ if templates.Exists "comments.html" }}
<div class="pt-3">
<hr class="border-dotted border-neutral-300 dark:border-neutral-600" />
<div class="pt-3">

View File

@@ -2,11 +2,11 @@
{{ .Scratch.Set "scope" "list" }}
{{ if .Site.Params.taxonomy.showHero | default false }}
{{ $heroStyle := print "partials/hero/" .Site.Params.taxonomy.heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ $heroStyle := print "hero/" .Site.Params.taxonomy.heroStyle ".html" }}
{{ if templates.Exists ( printf "partials/%s" $heroStyle ) }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ partial "hero/basic.html" . }}
{{ end }}
{{- end -}}

View File

@@ -2,11 +2,11 @@
{{ .Scratch.Set "scope" "term" }}
{{ if .Site.Params.term.showHero | default false }}
{{ $heroStyle := print "partials/hero/" .Site.Params.term.heroStyle ".html" }}
{{ if templates.Exists $heroStyle }}
{{ $heroStyle := print "hero/" .Site.Params.term.heroStyle ".html" }}
{{ if templates.Exists ( printf "partials/%s" $heroStyle ) }}
{{ partial $heroStyle . }}
{{ else }}
{{ partial "partials/hero/basic.html" . }}
{{ partial "hero/basic.html" . }}
{{ end }}
{{- end -}}

View File

@@ -1,8 +1,8 @@
{{ define "main" }}
{{ $partial := print "partials/home/" .Site.Params.homepage.layout ".html" }}
{{ if templates.Exists $partial }}
{{ $partial := print "home/" .Site.Params.homepage.layout ".html" }}
{{ if templates.Exists ( printf "partials/%s" $partial ) }}
{{ partial $partial . }}
{{ else }}
{{ partial "partials/home/profile.html" . }}
{{ partial "home/profile.html" . }}
{{ end }}
{{ end }}

View File

@@ -85,7 +85,7 @@
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
</div>
{{ end }}
{{ if templates.Exists "partials/extend-article-link.html" }}
{{ if templates.Exists "extend-article-link.html" }}
{{ partial "extend-article-link.html" . }}
{{ end }}
</div>

View File

@@ -62,7 +62,7 @@
{{ $jsProcess = $jsProcess | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsProcess.RelPermalink }}" integrity="{{ $jsProcess.Data.Integrity }}"></script>
{{/* Extend footer - eg. for extra scripts, etc. */}}
{{ if templates.Exists "partials/extend-footer.html" }}
{{ if templates.Exists "extend-footer.html" }}
{{ partialCached "extend-footer.html" . }}
{{ end }}
</footer>

View File

@@ -80,7 +80,7 @@
<script src="{{ $zoomJS.RelPermalink }}" integrity="{{ $zoomJS.Data.Integrity }}"></script>
{{ end }}
{{/* Icons */}}
{{ if templates.Exists "partials/favicons.html" }}
{{ if templates.Exists "favicons.html" }}
{{ partialCached "favicons.html" .Site }}
{{ else }}
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}" />
@@ -123,7 +123,7 @@
{{/* Analytics */}}
{{ partial "analytics/main.html" .Site }}
{{/* Extend head - eg. for custom analytics scripts, etc. */}}
{{ if templates.Exists "partials/extend-head.html" }}
{{ if templates.Exists "extend-head.html" }}
{{ partialCached "extend-head.html" .Site }}
{{ end }}
<meta name="theme-color"/>

View File

@@ -2,7 +2,7 @@
<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100">
<div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom bg-neutral dark:bg-neutral-800"></div>
<div class="relative max-w-[64rem] ml-auto mr-auto">
{{ partial "partials/header/basic.html" . }}
{{ partial "header/basic.html" . }}
</div>
</div>
<script>

View File

@@ -1,6 +1,6 @@
<div class="min-h-[148px]"></div>
<div class="fixed inset-x-0 pl-[24px] pr-[24px] bg-neutral dark:bg-neutral-800" style="z-index:100">
<div class="relative max-w-[64rem] ml-auto mr-auto">
{{ partial "partials/header/basic.html" . }}
{{ partial "header/basic.html" . }}
</div>
</div>

View File

@@ -3,7 +3,7 @@
<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100">
<div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl shadow-2xl"></div>
<div class="relative max-w-[64rem] ml-auto mr-auto">
{{ partial "partials/header/basic.html" . }}
{{ partial "header/basic.html" . }}
</div>
</div>
<script>

View File

@@ -2,7 +2,7 @@
<div class="fixed inset-x-0 pl-[24px] pr-[24px]" style="z-index:100">
<div id="menu-blur" class="absolute opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl shadow-2xl"></div>
<div class="relative max-w-[64rem] ml-auto mr-auto">
{{ partial "partials/header/basic.html" . }}
{{ partial "header/basic.html" . }}
</div>
</div>
<script>

View File

@@ -1,6 +1,6 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
{{ if .Get "default" }}
{{ template "_internal/shortcodes/figure.html" . }}
{{ partial "shortcodes/figure.html" . }}
{{ else }}
{{- $url := urls.Parse (.Get "src") }}
{{- $altText := .Get "alt" }}