Skip to content

Commit

Permalink
Rename and refactor shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
salim-b authored and bep committed May 3, 2021
1 parent e995375 commit 4230f8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion content/en/variables/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion content/en/variables/site.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}}



Expand Down
Original file line number Diff line number Diff line change
@@ -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 -}}

Expand Down

0 comments on commit 4230f8f

Please sign in to comment.