Add image_raw, image_stretch, image_url params to home.html

This commit is contained in:
Will Faught
2023-01-08 00:30:49 -08:00
parent 9b176c4868
commit 50565f9683
8 changed files with 45 additions and 41 deletions

View File

@@ -2,26 +2,27 @@
{{ $class := .class }}
{{ $crossorigin := .crossorigin | default "anonymous" }}
{{ $fetchpriority := .fetchpriority }}
{{ $fingerprint := .fingerprint | default true }}
{{ $height := .height }}
{{ $loading := .loading | default "lazy" }}
{{ $method := .method }}
{{ $options := .options }}
{{ $page := .page }}
{{ $raw := .raw }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
{{ $remote := .remote }}
{{ $resource := .resource }}
{{ $src := .src }}
{{ $style := .style }}
{{ $title := .title }}
{{ $width := .width }}
{{ if $remote }}
{{ if $raw }}
{{ $src = relLangURL $src }}
{{ else }}
{{ if not $resource }}
{{ $resource = partial "paige/func-resource.html" (dict
"page" $page
"url" $src
"url" (relLangURL $src)
) }}
{{ end }}
{{ if and $method $options }}
@@ -37,7 +38,10 @@
{{ errorf "invalid method: %q" $method }}
{{ end }}
{{ end }}
{{ $src = ($resource | fingerprint).RelPermalink }}
{{ if $fingerprint }}
{{ $resource = $resource | fingerprint }}
{{ end }}
{{ $src = $resource.RelPermalink }}
{{ end }}
<img {{ with $alt }} alt="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ end }} {{ with $crossorigin }} crossorigin="{{ . }}" {{ end }} {{ with $fetchpriority }} fetchpriority="{{ . }}" {{ end }} {{ with $height }} height="{{ . }}" {{ end }} loading="{{ $loading }}" referrerpolicy="{{ $referrerpolicy }}" src="{{ $src }}" {{ with $style }} style="{{ . | safeCSS }}" {{ end }} {{ with $title }} title="{{ . }}" {{ end }} {{ with $width }} width="{{ . }}" {{ end }}>

View File

@@ -2,15 +2,15 @@
{{ $href := .href }}
{{ $integrity := .integrity }}
{{ $page := .page }}
{{ $raw := .raw }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
{{ $remote := .remote }}
{{ if $remote }}
{{ if $raw }}
{{ $href = relLangURL $href }}
{{ else }}
{{ $resource := (partial "paige/func-resource.html" (dict
"page" $page
"url" $href
"url" (relLangURL $href)
)) | minify | fingerprint }}
{{ $href = $resource.RelPermalink }}
{{ $integrity = $resource.Data.Integrity }}

View File

@@ -11,18 +11,18 @@
{{ partial "paige/link.html" (dict
"href" (.Site.Params.paige.bootstrap.icons.link_href | default "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css")
"integrity" .Site.Params.paige.bootstrap.icons.link_integrity
"remote" true
"raw" true
) }}
{{ partial "paige/link.html" (dict
"href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css")
"integrity" .Site.Params.paige.bootstrap.style.link_integrity
"remote" .Site.Params.paige.bootstrap.style.remote
"raw" .Site.Params.paige.bootstrap.style.raw
) }}
{{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }}
{{ partial "paige/link.html" (dict
"href" (.Site.Params.paige.math.style.link_href | default "https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.css")
"integrity" (.Site.Params.paige.math.style.link_integrity | default "sha256-NJNVfEC6jfEt62wQMafLNT2eI6BaWONXbpkSEVAs3+8=")
"remote" true
"raw" true
) }}
{{ end }}
{{ if .AlternativeOutputFormats }}

View File

@@ -4,15 +4,15 @@
{{ $onload := .onload | safeJS }}
{{ $page := .page }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
{{ $remote := .remote }}
{{ $raw := .raw }}
{{ $src := .src }}
{{ if $remote }}
{{ if $raw }}
{{ $src = relLangURL $src }}
{{ else }}
{{ $resource := (partial "paige/func-resource.html" (dict
"page" $page
"url" $src
"url" (relLangURL $src)
)) | minify | fingerprint }}
{{ $integrity = $resource.Data.Integrity }}
{{ $src = $resource.RelPermalink }}

View File

@@ -48,19 +48,19 @@ paigeQuery.addEventListener("change", function (e) {
</script>
{{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.bootstrap.script.script_integrity
"remote" .Site.Params.paige.bootstrap.script.remote
"raw" .Site.Params.paige.bootstrap.script.raw
"src" (.Site.Params.paige.bootstrap.script.script_src | default "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js")
) }}
{{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }}
{{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.math.script.script_integrity
"remote" .Site.Params.paige.math.script.remote
"raw" .Site.Params.paige.math.script.raw
"src" (.Site.Params.paige.math.script.script_src | default "https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.js")
) }}
{{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.math.autorender.script_integrity
"onload" "renderMathInElement(document.body);"
"remote" .Site.Params.paige.math.autorender.remote
"raw" .Site.Params.paige.math.autorender.raw
"src" (.Site.Params.paige.math.autorender.script_src | default "https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/contrib/auto-render.min.js")
) }}
{{ end }}