diff options
author | Ivan Boothe <git@rootwork.org> | 2022-04-29 00:00:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 00:00:05 +0300 |
commit | 771304dd22a43a4cf068ba6ef51e3d6e9545f60e (patch) | |
tree | 1189fb94bc75786f5d702ce4fdc29a80b8204087 | |
parent | 3fcb1db2eaddee13cd5c9b1a69e7e644edf079c8 (diff) | |
parent | dffa2f3485ffd4f1d7375ed4f2737c5042a25fa5 (diff) |
Merge pull request #292 from chipzoller/image-handling-improvements
Closes #291
-rw-r--r-- | layouts/_default/single.html | 12 | ||||
-rw-r--r-- | layouts/partials/figure.html | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 066d72d..6fa6fd6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -14,16 +14,16 @@ {{- $t := .Title }} <h1 class="post_title">{{ $t }}</h1> {{- partial "post-meta" . }} - {{- if .Params.featureImage -}} + {{- with .Params.featureImage -}} <div class="post_featured"> - {{- partial "image" (dict "file" .Params.featureImage "type" "featured") }} + {{- partial "image" (dict "file" . "type" "featured" "Page" $.Page) }} </div> {{- end -}} {{ if $p.toc }} - <div class="post_toc"> - <h2>{{ T "overview" }}</h2> - {{ .TableOfContents }} - </div> + <div class="post_toc"> + <h2>{{ T "overview" }}</h2> + {{ .TableOfContents }} + </div> {{ end }} <div class="post_body"> {{- .Content }} diff --git a/layouts/partials/figure.html b/layouts/partials/figure.html index 3d797e2..8b38535 100644 --- a/layouts/partials/figure.html +++ b/layouts/partials/figure.html @@ -17,6 +17,10 @@ {{- $classes := .classes -}} {{- $bundle := .bundle -}} +{{- if eq $bundle true -}} + {{ $file = path.Join "/" $dir $file }} +{{- end -}} + <figure> <picture> @@ -26,9 +30,6 @@ {{ $ext := slice "avif" "webp" "jxl" }} {{- range $ext -}} {{ $path := printf "%s" . | printf "%s%s" "." | printf "%s%s" $name | printf "%s" }} - {{- if eq $bundle true -}} - {{ $path = path.Join "/" $dir $path }} - {{- end -}} {{- if fileExists $path -}} <source srcset="{{ $path }}" type="image/{{ . }}"> {{- end -}} |