From 4230f8fa5469249630970a5983114ae1cbc26413 Mon Sep 17 00:00:00 2001 From: Salim B Date: Sat, 1 May 2021 19:34:04 +0200 Subject: [PATCH] Rename and refactor shortcode --- content/en/variables/page.md | 2 +- content/en/variables/site.md | 2 +- layouts/shortcodes/{insertpages.html => getcontent.html} | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) rename layouts/shortcodes/{insertpages.html => getcontent.html} (66%) diff --git a/content/en/variables/page.md b/content/en/variables/page.md index c98e2586c..4ba4d3d91 100644 --- a/content/en/variables/page.md +++ b/content/en/variables/page.md @@ -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 diff --git a/content/en/variables/site.md b/content/en/variables/site.md index 0bf54a7fa..03052d053 100644 --- a/content/en/variables/site.md +++ b/content/en/variables/site.md @@ -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" >}} diff --git a/layouts/shortcodes/insertpages.html b/layouts/shortcodes/getcontent.html similarity index 66% rename from layouts/shortcodes/insertpages.html rename to layouts/shortcodes/getcontent.html index a7cfc83fd..61a84e431 100644 --- a/layouts/shortcodes/insertpages.html +++ b/layouts/shortcodes/getcontent.html @@ -1,18 +1,18 @@ {{- $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 -}}