Merge pull request #21465 from dvdksn/hugo-use-shortcode-store

hugo: replace Shortcode.Scratch with Shortcode.Store
This commit is contained in:
David Karlsson 2024-11-19 15:18:19 +01:00 committed by GitHub
commit 3326f3bc7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -244,7 +244,7 @@ module:
proxy: https://proxy.golang.org,direct
hugoVersion:
extended: false
min: "0.124.1"
min: "0.139.0"
mounts:
- source: assets
target: assets

View File

@ -4,9 +4,9 @@
{{ $name := trim (.Get "name") " " }}
{{ if not (.Parent.Scratch.Get "tabs") }}
{{ .Parent.Scratch.Set "tabs" slice }}
{{ if not (.Parent.Store.Get "tabs") }}
{{ .Parent.Store.Set "tabs" slice }}
{{ end }}
{{ with .Inner }}
{{ $.Parent.Scratch.Add "tabs" (dict "name" $name "content" . ) }}
{{ $.Parent.Store.Add "tabs" (dict "name" $name "content" . ) }}
{{ end }}

View File

@ -1,5 +1,5 @@
{{ with .Inner }}{{/* don't do anything, just call it */}}{{ end }}
{{ $first := urlize (index (.Scratch.Get "tabs") 0).name }}
{{ $first := urlize (index (.Store.Get "tabs") 0).name }}
{{ $group := .Get "group" }}
{{ $groupID := fmt.Printf "tabgroup-%s" (urlize $group) }}
{{ $persist := .Get "persist" }}
@ -19,7 +19,7 @@
{{ end }}
aria-role="tabpanel">
<div aria-role="tablist" class="space-x-2">
{{ range (.Scratch.Get "tabs") }}
{{ range (.Store.Get "tabs") }}
<button
class="p-1"
:class="selected === '{{ .name | urlize }}' &&
@ -37,7 +37,7 @@
</div>
<hr class="!mt-0" />
<div>
{{ range (.Scratch.Get "tabs") }}
{{ range (.Store.Get "tabs") }}
<div
aria-role="tab"
:class="selected !== '{{ .name | urlize }}' && 'hidden'"