shortcodes: intermediately use random ids instead of .Ordinal #543

This commit is contained in:
Sören Weber 2023-05-25 15:45:57 +02:00
parent f0434c3379
commit 47f85b4eb1
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
5 changed files with 12 additions and 5 deletions

View file

@ -3,7 +3,7 @@
{{- $minor := int (index $version 1) }} {{- $minor := int (index $version 1) }}
{{- $id := "" }} {{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }} {{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = .Ordinal }} {{- $id = "" }}
{{- end }} {{- end }}
{{- partial "shortcodes/image.html" (dict {{- partial "shortcodes/image.html" (dict
"context" .Page "context" .Page

View file

@ -4,7 +4,7 @@
{{- $minor := int (index $version 1) }} {{- $minor := int (index $version 1) }}
{{- $id := "" }} {{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }} {{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = .Ordinal }} {{- $id = "" }}
{{- end }} {{- end }}
{{- partial "shortcodes/expand.html" (dict {{- partial "shortcodes/expand.html" (dict
"context" .Page "context" .Page

View file

@ -3,7 +3,7 @@
{{- $minor := int (index $version 1) }} {{- $minor := int (index $version 1) }}
{{- $id := "" }} {{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }} {{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = .Ordinal }} {{- $id = "" }}
{{- end }} {{- end }}
{{- partial "shortcodes/openapi.html" (dict {{- partial "shortcodes/openapi.html" (dict
"context" .Page "context" .Page

View file

@ -3,7 +3,7 @@
{{- $minor := int (index $version 1) }} {{- $minor := int (index $version 1) }}
{{- $id := "" }} {{- $id := "" }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }} {{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $id = .Ordinal }} {{- $id = "" }}
{{- end }} {{- end }}
{{- partial "shortcodes/swagger.html" (dict {{- partial "shortcodes/swagger.html" (dict
"context" .Page "context" .Page

View file

@ -1,6 +1,13 @@
{{- $unused := .Inner }} {{- $unused := .Inner }}
{{- $version := split hugo.Version "." }}
{{- $major := int (index $version 0) }}
{{- $minor := int (index $version 1) }}
{{- $groupid := ((.Get "groupid") | default ((.Get "groupId") | default "")) }}
{{- if or (and (eq $major 0) (ge $minor 108)) (gt $major 0) }}
{{- $groupid = $groupid | default "" }}
{{- end }}
{{- partial "shortcodes/tabs.html" (dict {{- partial "shortcodes/tabs.html" (dict
"context" .Page "context" .Page
"groupid" ((.Get "groupid") | default (.Get "groupId")) "groupid" $groupid
"content" (.Scratch.Get "tabs") "content" (.Scratch.Get "tabs")
) }} ) }}