diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 500fc908ed..0bda2dd528 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,6 +1,14 @@ +{{- $version := split hugo.Version "." }} +{{- $major := int (index $version 0) }} +{{- $minor := int (index $version 1) }} +{{- $id := "" }} +{{- if and (ge $major 0) (ge $major 108) }} + {{- $id = .Ordinal }} +{{- end }} {{- partial "shortcodes/image.html" (dict "context" .Page "url" .Destination "title" .Title "alt" .Text + "id" $id ) }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/expand.html b/layouts/partials/shortcodes/expand.html index a5c29ccd0b..d9132e3907 100644 --- a/layouts/partials/shortcodes/expand.html +++ b/layouts/partials/shortcodes/expand.html @@ -6,8 +6,8 @@ {{- if eq (printf "%T" $expanded) "string" }} {{- $expanded = (eq $expanded "true") }} {{- end }} +{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo") .id }} {{- with $context }} -{{- $id := partial "make-random-md5.hugo" }}