From 6b70757505451c47084295596488002e00fcce5b Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sat, 1 Jun 2024 19:21:51 +0100 Subject: [PATCH] feat(tailwind): add include shortcode for re-usable Markdown blocks --- .../layouts/shortcodes/include.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/blox-tailwind/layouts/shortcodes/include.html diff --git a/modules/blox-tailwind/layouts/shortcodes/include.html b/modules/blox-tailwind/layouts/shortcodes/include.html new file mode 100644 index 00000000..e20a8b84 --- /dev/null +++ b/modules/blox-tailwind/layouts/shortcodes/include.html @@ -0,0 +1,23 @@ +{{- /* + Docs: https://docs.hugoblox.com/reference/markdown/#include + + Parameters + ---------- + postional parameter 0 : + Path to the Markdown file to include, relative to the `content` folder. + + Example + ---------- + {{% include "snippet/intro" %}} +*/ -}} + +{{- with .Get 0 }} + {{- $page := . -}} + {{- with site.GetPage $page }} + {{- .RenderShortcodes }} + {{- else }} + {{- errorf "The %q shortcode at %s could not locate %q" $.Name $.Position (printf "content/%s.md" .) }} + {{- end }} +{{- else }} + {{- errorf "Call the %q shortcode in %s with the path of the Markdown file to include." .Name .Position }} +{{- end }} \ No newline at end of file