chore: refactor deprecated site.Data -> hugo.Data

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson
2026-05-01 09:22:27 +02:00
parent d480f7b0eb
commit 122761ce2f
15 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
{{- /*
Content adapter for CLI reference pages.
Generates pages from YAML data files in site.Data, replacing the ~386 stub
Generates pages from YAML data files in hugo.Data, replacing the ~386 stub
Markdown files that previously lived under content/reference/cli/docker/.
For each data file it creates a page at the command path (spaces → slashes).
@@ -18,7 +18,7 @@
so they still appear in the sidebar navigation.
*/ -}}
{{- range $folder, $files := site.Data.cli -}}
{{- range $folder, $files := hugo.Data.cli -}}
{{- range $name, $data := $files -}}
{{- /* Skip hidden commands */ -}}
{{- if $data.hidden -}}
+2 -2
View File
@@ -1,13 +1,13 @@
{{- /*
Content adapter for sbx CLI reference pages.
Generates pages from YAML data files in site.Data.sbx_cli (cobra/doc format).
Generates pages from YAML data files in hugo.Data.sbx_cli (cobra/doc format).
For each YAML file it creates a page at the command path (spaces → slashes).
Commands with child entries in see_also become Hugo sections; others become
regular pages.
*/ -}}
{{- range $name, $data := site.Data.sbx_cli -}}
{{- range $name, $data := hugo.Data.sbx_cli -}}
{{- if not $data.name -}}
{{- continue -}}
{{- end -}}
+1 -1
View File
@@ -1,5 +1,5 @@
{{- range . -}}
{{- $lang := index site.Data.languages . -}}
{{- $lang := index hugo.Data.languages . -}}
{{- with $lang }}
<span class="chip">
<img
+1 -1
View File
@@ -1,5 +1,5 @@
{{- range . -}}
{{- $tag := index site.Data.tags . -}}
{{- $tag := index hugo.Data.tags . -}}
{{- with $tag }}
<span class="chip">
<span class="icon-svg icon-sm pb-0.5">{{ partialCached "icon" "tag" "tag" }}</span>
+2 -2
View File
@@ -1,6 +1,6 @@
{{- /*
Utility template to extract a description for the current page.
- Prioritizes `.Description` or falls back to front matter in `site.Data.frontmatter`.
- Prioritizes `.Description` or falls back to front matter in `hugo.Data.frontmatter`.
- Replaces newlines with spaces and trims trailing spaces.
- Designed for reuse via `partial` calls to generate meta descriptions or similar content.
*/ -}}
@@ -9,7 +9,7 @@
{{ $desc = strings.Replace .Description "\n" " " }}
{{ else }}
{{ with .File }}
{{ with (index (site.Data.frontmatter) .Path) }}
{{ with (index (hugo.Data.frontmatter) .Path) }}
{{ with .description }}
{{ $desc = strings.Replace . "\n" " " | strings.TrimRight " " }}
{{ end }}
+2 -2
View File
@@ -1,6 +1,6 @@
{{- /*
Utility template to extract keywords for the current page.
- Uses `.Keywords` if available or falls back to front matter in `site.Data.frontmatter`.
- Uses `.Keywords` if available or falls back to front matter in `hugo.Data.frontmatter`.
- Cleans and trims keywords, joining them into a comma-separated string.
- Intended for reuse in meta tags or other keyword-based contexts.
*/ -}}
@@ -9,7 +9,7 @@
{{ $keywords = collections.Apply .Keywords "strings.Trim" "." ", " }}
{{ else }}
{{ with .File }}
{{ with (index (site.Data.frontmatter) .Path) }}
{{ with (index (hugo.Data.frontmatter) .Path) }}
{{ with .keywords }}
{{ $keywords = collections.Apply (strings.Split (strings.Replace . "\n" " ") ",") "strings.Trim" "." " " }}
{{ end }}
+1 -1
View File
@@ -1,5 +1,5 @@
{{ $featureName := .Get "feature_name" }}
{{ $feature := index site.Data.summary $featureName }}
{{ $feature := index hugo.Data.summary $featureName }}
{{ if not $feature }}
{{ errorf "[summary-bar] invalid feature: %s %v" $featureName .Position }}
{{ end }}
+2 -2
View File
@@ -1,5 +1,5 @@
{{ define "article" }}
{{ $data := index site.Data.cli .Params.datafolder .Params.datafile }}
{{ $data := index hugo.Data.cli .Params.datafolder .Params.datafile }}
{{ .Store.Set "headings" slice }}
{{ .Store.Set "subheadings" slice }}
@@ -185,7 +185,7 @@ can be removed entirely in a future release.
{{- if and .Params.datafolder .Params.datafile }}
<tr>
<td class="text-left"><a class="link" href="{{ .Permalink }}"><code>{{ .Title }}</code></a></th>
{{ $data := index site.Data.cli .Params.datafolder .Params.datafile }}
{{ $data := index hugo.Data.cli .Params.datafolder .Params.datafile }}
<td class="text-left">{{ $data.short }}</th>
</tr>
{{- end }}
+2 -2
View File
@@ -1,4 +1,4 @@
{{- $data := index site.Data.cli .Params.datafolder .Params.datafile -}}
{{- $data := index hugo.Data.cli .Params.datafolder .Params.datafile -}}
# {{ .Title }}
{{ with $data.short }}**Description:** {{ . }}{{ end }}
@@ -44,6 +44,6 @@
| Command | Description |
|---------|-------------|
{{ range .Pages }}{{ if and .Params.datafolder .Params.datafile }}{{ $subdata := index site.Data.cli .Params.datafolder .Params.datafile }}| [`{{ .Title }}`]({{ .Permalink }}) | {{ $subdata.short }} |
{{ range .Pages }}{{ if and .Params.datafolder .Params.datafile }}{{ $subdata := index hugo.Data.cli .Params.datafolder .Params.datafile }}| [`{{ .Title }}`]({{ .Permalink }}) | {{ $subdata.short }} |
{{ end }}{{ end }}
{{ end }}
+1 -1
View File
@@ -15,7 +15,7 @@
</tr>
</thead>
<tbody>
{{ range $term, $definition := site.Data.glossary }}
{{ range $term, $definition := hugo.Data.glossary }}
<tr>
<td class="not-prose">
<a class="-top-16 relative" name="{{ $term | anchorize }}"></a>
+4 -4
View File
@@ -40,7 +40,7 @@
>
<div class="pl-2"><strong>Tags</strong></div>
<fieldset class="flex flex-col gap-2">
{{- range $name, $data := site.Data.tags }}
{{- range $name, $data := hugo.Data.tags }}
{{- if where $.Pages "Params.tags" "intersect" (slice $name) }}
{{- $id := anchorize (fmt.Printf "tag-%s" $name) }}
<div class="flex gap-2 pl-2">
@@ -60,7 +60,7 @@
</fieldset>
<div class="pl-2"><strong>Languages</strong></div>
<fieldset class="flex flex-wrap gap-2 pl-2">
{{- range $name, $data := site.Data.languages }}
{{- range $name, $data := hugo.Data.languages }}
{{- if where $.Pages "Params.languages" "intersect" (slice $name) }}
{{- $id := anchorize (fmt.Printf "lang-%s" $name) }}
<button
@@ -193,12 +193,12 @@
</p>
</div>
<div class="flex items-center gap-2 pl-4">
{{- range $name, $data := site.Data.tags }}
{{- range $name, $data := hugo.Data.tags }}
<div x-show="filters.tags.includes('{{ $name }}')">
{{ template "termchip" $data.title }}
</div>
{{- end }}
{{- range $name, $data := site.Data.languages }}
{{- range $name, $data := hugo.Data.languages }}
<div
x-show="filters.languages.includes('{{ $name }}')"
class="border-divider-light dark:border-divider-dark inline-flex items-center gap-1 rounded-full border bg-gray-100 px-2 text-sm text-gray-200 select-none dark:bg-gray-800 dark:text-gray-300"
+1 -1
View File
@@ -5,7 +5,7 @@
{{- $kwd := partialCached "utils/keywords.html" . . -}}
{{- $tags := slice -}}
{{- range (.Params.tags | default slice) -}}
{{- $tagData := index site.Data.tags . -}}
{{- $tagData := index hugo.Data.tags . -}}
{{- with $tagData -}}
{{ $tags = $tags | append .title }}
{{- end -}}
+1 -1
View File
@@ -12,7 +12,7 @@
</tr>
</thead>
<tbody>
{{ range site.Data.samples.samples }}
{{ range hugo.Data.samples.samples }}
{{ if in .services $.Params.service }}
<tr>
<td>{{ printf "[%s](%s)" .title .url | markdownify }}</td>
+1 -1
View File
@@ -2,7 +2,7 @@
| Name | Description |
|------|-------------|
{{- range site.Data.samples.samples }}
{{- range hugo.Data.samples.samples }}
{{- if in .services $.Params.service }}
| [{{ .title }}]({{ .url }}) | {{ chomp .description }} |
{{- end }}
+2 -2
View File
@@ -1,5 +1,5 @@
{{ define "article" }}
{{ $data := index site.Data.sbx_cli .Params.datafile }}
{{ $data := index hugo.Data.sbx_cli .Params.datafile }}
{{ .Store.Set "headings" slice }}
<article class="prose min-w-0 max-w-4xl dark:prose-invert">
@@ -51,7 +51,7 @@
<tbody>
{{ range .Pages }}
{{ if .Params.datafile }}
{{ $child := index site.Data.sbx_cli .Params.datafile }}
{{ $child := index hugo.Data.sbx_cli .Params.datafile }}
<tr>
<td class="text-left"><a class="link" href="{{ .Permalink }}"><code>{{ .Title }}</code></a></td>
<td class="text-left">{{ $child.synopsis }}</td>