Skip to content

Commit 54e84be

Browse files
committed
hugo(refactor): use Page.Store instead of Page.Scratch
Page.Scratch was soft-deprecated in v0.138.0 https://github.com/gohugoio/hugo/releases/tag/v0.138.0 Signed-off-by: David Karlsson <[email protected]>
1 parent 9ce9069 commit 54e84be

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

layouts/_default/cli.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{{ else }}
66
{{ $data = index site.Data .Params.datafile }}
77
{{ end }}
8-
{{ .Scratch.Set "headings" slice }}
9-
{{ .Scratch.Set "subheadings" slice }}
8+
{{ .Store.Set "headings" slice }}
9+
{{ .Store.Set "subheadings" slice }}
1010
<div class="flex w-full">
1111
<article class="prose min-w-0 flex-[2_2_0%] max-w-4xl dark:prose-invert">
1212
{{ partial "breadcrumbs.html" . }}
@@ -84,11 +84,11 @@ <h1 class="scroll-mt-36">{{ .Title }}</h1>
8484
{{ $heading := dict "level" 2 "text" "Description" }}
8585
{{ partialCached "heading.html" $heading "cli-description" }}
8686
{{ $subHeadings := (strings.FindRE `(?m:#{3,4} .*)` .) }}
87-
{{ $.Scratch.Add "headings" $heading }}
87+
{{ $.Store.Add "headings" $heading }}
8888
{{ range $subHeadings }}
8989
{{ $lvl := strings.Count "#" . }}
9090
{{ $txt := strings.TrimLeft "# " . }}
91-
{{ $.Scratch.Add "headings" (dict "level" $lvl "text" $txt) }}
91+
{{ $.Store.Add "headings" (dict "level" $lvl "text" $txt) }}
9292
{{ end }}
9393
{{ . | $.RenderString (dict "display" "block") }}
9494
{{ end }}
@@ -97,7 +97,7 @@ <h1 class="scroll-mt-36">{{ .Title }}</h1>
9797
{{ with $opts }}
9898
{{ $heading := dict "level" 2 "text" "Options" }}
9999
{{ partialCached "heading.html" $heading "cli-options" }}
100-
{{ $.Scratch.Add "headings" $heading }}
100+
{{ $.Store.Add "headings" $heading }}
101101
<div class="overflow-x-auto">
102102
<table>
103103
<thead class="bg-gray-light-100 dark:bg-gray-dark-200">
@@ -162,18 +162,18 @@ <h1 class="scroll-mt-36">{{ .Title }}</h1>
162162
{{ $heading := dict "level" 2 "text" "Examples" }}
163163
{{ partialCached "heading.html" $heading "cli-examples" }}
164164
{{ $subHeadings := (strings.FindRE `(?m:#{3,4} .*)` .) }}
165-
{{ $.Scratch.Add "headings" $heading }}
165+
{{ $.Store.Add "headings" $heading }}
166166
{{ range $subHeadings }}
167167
{{ $lvl := strings.Count "#" . }}
168168
{{ $txt := strings.TrimLeft "# " . }}
169-
{{ $.Scratch.Add "headings" (dict "level" $lvl "text" $txt) }}
169+
{{ $.Store.Add "headings" (dict "level" $lvl "text" $txt) }}
170170
{{ end }}
171171
{{ $.RenderString (dict "display" "block") . }}
172172
{{ end }}
173173
{{ if eq .Kind "section" }}
174174
{{ $heading := dict "level" 2 "text" "Subcommands" }}
175175
{{ partialCached "heading.html" $heading "cli-subcommands" }}
176-
{{ $.Scratch.Add "headings" $heading }}
176+
{{ $.Store.Add "headings" $heading }}
177177
<table>
178178
<thead>
179179
<tr>
@@ -202,7 +202,7 @@ <h1 class="scroll-mt-36">{{ .Title }}</h1>
202202
<div class="text-lg pb-2">{{ T "tableOfContents" }}</div>
203203
<nav class="toc">
204204
<ul>
205-
{{ range (.Scratch.Get "headings") }}
205+
{{ range (.Store.Get "headings") }}
206206
{{/* add left padding depending on level (pl-2, pl-3, pl-4) */}}
207207
{{ $slice := strings.Split .text "{#" }}
208208
{{ $text := index $slice 0 }}

0 commit comments

Comments
 (0)