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
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 center and stretch images
stretch_url: "my-stretch.jpg" # A 4x3 or panorama image that is stretched fully horizontally
greeting: "You know best" # Displayed below the image
image_raw: true # Do not copy or process the image
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:

@ -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).
description: Go ahead, touch the Cornballer
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
---

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

@ -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 }}>

@ -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 }}

@ -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 }}

@ -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 }}

@ -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 }}

Loading…
Cancel
Save