mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 10:46:17 -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" >}}
|
||||
{{< getcontent path="PATH/TO/BUNDLE/" glob="*_PATTERN.md" >}}
|
||||
@ -7,15 +7,15 @@ Usage: {{< getcontent path="PATH/TO/FILE" >}}
|
||||
{{- $path := .Get "path" -}}
|
||||
{{ $glob := .Get "glob" -}}
|
||||
|
||||
{{ $scratch := newScratch -}}
|
||||
{{ $resources := slice -}}
|
||||
{{ with $glob -}}
|
||||
{{ $bundle := site.GetPage $path -}}
|
||||
{{ $scratch.Set "resources" ($bundle.Resources.Match $glob) -}}
|
||||
{{ $resources = $bundle.Resources.Match $glob -}}
|
||||
{{ else -}}
|
||||
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
||||
{{ $scratch.Set "resources" ($bundle.Resources.Match (path.Base $path)) -}}
|
||||
{{ $resources = $bundle.Resources.Match (path.Base $path) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range ($scratch.Get "resources") -}}
|
||||
{{ range $resources -}}
|
||||
{{ .Content }}
|
||||
{{ end -}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user