Add image_raw, image_stretch, image_url params to home.html

master
Will Faught 3 years ago
parent 9b176c4868
commit 50565f9683

@ -318,9 +318,10 @@ Additional optional home page parameters:
```yaml ```yaml
blurb: "There's a new daddy in town." # Displayed below the greeting blurb: "There's a new daddy in town." # Displayed below the greeting
center_url: "my-center.jpg" # An image that is centered greeting: "You know best" # Displayed below the image
greeting: "You know best" # Displayed below the center and stretch images image_raw: true # Do not copy or process the image
stretch_url: "my-stretch.jpg" # A 4x3 or panorama image that is stretched fully horizontally image_stretch: true # Stretch the image fully horizontally if true; center the image otherwise
image_url: "me.jpg" # A page, site, or remote resource glob
``` ```
Additional optional list page parameters: Additional optional list page parameters:

@ -2,7 +2,8 @@
blurb: There's a new daddy in town. A discipline daddy. If I make this comeback, I'll buy you a hundred George Michaels that you can teach to drive! These are my awards, Mother. From Army. The seal is for marksmanship, and the gorilla is for sand racing. We'll have to find something to do so that people can look at you without wanting to kill [themselves](https://bluthipsum.com). blurb: There's a new daddy in town. A discipline daddy. If I make this comeback, I'll buy you a hundred George Michaels that you can teach to drive! These are my awards, Mother. From Army. The seal is for marksmanship, and the gorilla is for sand racing. We'll have to find something to do so that people can look at you without wanting to kill [themselves](https://bluthipsum.com).
description: Go ahead, touch the Cornballer description: Go ahead, touch the Cornballer
greeting: You know [best](https://www.youtube.com/watch?v=1WDW8XKEGgU) greeting: You know [best](https://www.youtube.com/watch?v=1WDW8XKEGgU)
stretch_url: stretch.webp image_stretch: true
image_url: stretch.webp
title: No Borders, No Limits title: No Borders, No Limits
--- ---

@ -2,27 +2,25 @@
<article> <article>
{{ partial "paige/metadata.html" . }} {{ partial "paige/metadata.html" . }}
<section> <section>
{{ with .Params.stretch_url }} {{ if .Params.image_url }}
<p> {{ $class := "mw-100 rounded-4 shadow" }}
{{ partial "paige/img.html" (dict {{ if .Params.image_stretch }}
"class" "mw-100 rounded-4 shadow" {{ $class = "rounded-4 shadow w-100" }}
"fetchpriority" "high" {{ end }}
"loading" "eager" {{ $style := "height: 20rem" }}
"src" . {{ if .Params.image_stretch }}
"style" "height: 20rem; object-fit: cover; width: 100%" {{ $style = "height: 20rem; object-fit: cover" }}
) }} {{ end }}
</p> <p {{ if not .Params.image_stretch }} class="text-center" {{ end }}>
{{ end }} {{ partial "paige/img.html" (dict
{{ with .Params.center_url }} "class" $class
<p class="text-center"> "fetchpriority" "high"
{{ partial "paige/img.html" (dict "loading" "eager"
"class" "mw-100 rounded-4 shadow" "raw" .Params.image_raw
"fetchpriority" "high" "src" .Params.image_url
"loading" "eager" "style" $style
"src" . ) }}
"style" "height: 20rem" </p>
) }}
</p>
{{ end }} {{ end }}
{{ with .Params.greeting }} {{ with .Params.greeting }}
<p class="display-5 fw-bold h2 text-center">{{ . | markdownify }}</p> <p class="display-5 fw-bold h2 text-center">{{ . | markdownify }}</p>

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

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

@ -11,18 +11,18 @@
{{ partial "paige/link.html" (dict {{ 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") "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 "integrity" .Site.Params.paige.bootstrap.icons.link_integrity
"remote" true "raw" true
) }} ) }}
{{ partial "paige/link.html" (dict {{ 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") "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 "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)) }} {{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }}
{{ partial "paige/link.html" (dict {{ 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") "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=") "integrity" (.Site.Params.paige.math.style.link_integrity | default "sha256-NJNVfEC6jfEt62wQMafLNT2eI6BaWONXbpkSEVAs3+8=")
"remote" true "raw" true
) }} ) }}
{{ end }} {{ end }}
{{ if .AlternativeOutputFormats }} {{ if .AlternativeOutputFormats }}

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

@ -48,19 +48,19 @@ paigeQuery.addEventListener("change", function (e) {
</script> </script>
{{ partial "paige/script.html" (dict {{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.bootstrap.script.script_integrity "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") "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)) }} {{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }}
{{ partial "paige/script.html" (dict {{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.math.script.script_integrity "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") "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 {{ partial "paige/script.html" (dict
"integrity" .Site.Params.paige.math.autorender.script_integrity "integrity" .Site.Params.paige.math.autorender.script_integrity
"onload" "renderMathInElement(document.body);" "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") "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 }} {{ end }}

Loading…
Cancel
Save