mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 23:38:53 +00:00
Rename and refactor shortcode
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
e9953751ec
commit
4230f8fa54
@@ -204,7 +204,7 @@ aliased form `.Pages`.
|
||||
|
||||
### `.Pages` compared to `.Site.Pages`
|
||||
|
||||
{{< insertpages path="readfiles/pages-vs-site-pages.md" >}}
|
||||
{{< getcontent path="readfiles/pages-vs-site-pages.md" >}}
|
||||
|
||||
## Page-level Params
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call
|
||||
|
||||
### `.Site.Pages` compared to `.Pages`
|
||||
|
||||
{{< insertpages path="readfiles/pages-vs-site-pages.md" >}}
|
||||
{{< getcontent path="readfiles/pages-vs-site-pages.md" >}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<!-- {{/*
|
||||
Insert page `.Content` from a (headless) bundle; you can insert `.Content` from multiple page resources of the same bundle by specifying `glob`
|
||||
|
||||
Usage: {{< insertpages path="PATH/TO/MD_FILE" >}}
|
||||
{{< insertpages path="PATH/TO/BUNDLE" glob="*_PATTERN.md" >}}
|
||||
Usage: {{< insertpages path="PATH/TO/FILE" >}}
|
||||
{{< insertpages path="PATH/TO/BUNDLE/" glob="*_PATTERN.md" >}}
|
||||
*/}} -->
|
||||
{{- $path := .Get "path" -}}
|
||||
{{ $glob := .Get "glob" -}}
|
||||
|
||||
{{ $scratch := newScratch -}}
|
||||
{{ with $glob -}}
|
||||
{{ $bundle := site.GetPage (path.Join $path "index.md") -}}
|
||||
{{ $bundle := site.GetPage $path -}}
|
||||
{{ $scratch.Set "pages" ($bundle.Resources.Match $glob) -}}
|
||||
{{ else -}}
|
||||
{{ $bundle := site.GetPage (path.Join (path.Dir $path) "index.md") -}}
|
||||
{{ $bundle := site.GetPage (path.Dir $path) -}}
|
||||
{{ $scratch.Set "pages" ($bundle.Resources.Match (path.Base $path)) -}}
|
||||
{{ end -}}
|
||||
|
||||
Reference in New Issue
Block a user