mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 23:36:06 -04:00
Avoid scratch usage
This commit is contained in:
parent
696fa92e11
commit
0c8f2dcb13
@ -1,5 +1,5 @@
|
|||||||
<!-- {{/*
|
<!-- {{/*
|
||||||
Insert `.Content` from a (headless) bundle; you can insert `.Content` from multiple page resources of the same bundle by specifying `glob`
|
Insert `.Content` from a (headless) bundle. You can insert `.Content` from multiple page resources of the same bundle by specifying `glob`.
|
||||||
|
|
||||||
Usage: {{< getcontent path="PATH/TO/FILE" >}}
|
Usage: {{< getcontent path="PATH/TO/FILE" >}}
|
||||||
{{< getcontent path="PATH/TO/BUNDLE/" glob="*_PATTERN.md" >}}
|
{{< getcontent path="PATH/TO/BUNDLE/" glob="*_PATTERN.md" >}}
|
||||||
@ -7,15 +7,15 @@ Usage: {{< getcontent path="PATH/TO/FILE" >}}
|
|||||||
{{- $path := .Get "path" -}}
|
{{- $path := .Get "path" -}}
|
||||||
{{ $glob := .Get "glob" -}}
|
{{ $glob := .Get "glob" -}}
|
||||||
|
|
||||||
{{ $scratch := newScratch -}}
|
{{ $resources := slice -}}
|
||||||
{{ with $glob -}}
|
{{ with $glob -}}
|
||||||
{{ $bundle := site.GetPage $path -}}
|
{{ $bundle := site.GetPage $path -}}
|
||||||
{{ $scratch.Set "resources" ($bundle.Resources.Match $glob) -}}
|
{{ $resources = $bundle.Resources.Match $glob -}}
|
||||||
{{ else -}}
|
{{ else -}}
|
||||||
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
||||||
{{ $scratch.Set "resources" ($bundle.Resources.Match (path.Base $path)) -}}
|
{{ $resources = $bundle.Resources.Match (path.Base $path) -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
{{ range ($scratch.Get "resources") -}}
|
{{ range $resources -}}
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user