mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Merge commit '32ba623541d74ee0b7ae4efb1b8326dc49af28b8'
This commit is contained in:
21
docs/layouts/shortcodes/getcontent.html
Normal file
21
docs/layouts/shortcodes/getcontent.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!-- {{/*
|
||||
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" >}}
|
||||
*/}} -->
|
||||
{{- $path := .Get "path" -}}
|
||||
{{ $glob := .Get "glob" -}}
|
||||
|
||||
{{ $resources := slice -}}
|
||||
{{ with $glob -}}
|
||||
{{ $bundle := site.GetPage $path -}}
|
||||
{{ $resources = $bundle.Resources.Match $glob -}}
|
||||
{{ else -}}
|
||||
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
||||
{{ $resources = $bundle.Resources.Match (path.Base $path) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range $resources -}}
|
||||
{{ .Content }}
|
||||
{{ end -}}
|
Reference in New Issue
Block a user