From d96c96392de4670a7e5838c3303907be199ed063 Mon Sep 17 00:00:00 2001 From: Jack Tracey <41163455+jtracey93@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:01:13 +0000 Subject: [PATCH] add new remote inlcudes shortcode support --- docs/layouts/shortcodes/include.html | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/layouts/shortcodes/include.html diff --git a/docs/layouts/shortcodes/include.html b/docs/layouts/shortcodes/include.html new file mode 100644 index 0000000..18eda15 --- /dev/null +++ b/docs/layouts/shortcodes/include.html @@ -0,0 +1,29 @@ +{{ $file := .Get "file" }} +{{ $url := .Get "url" }} +{{ $type := .Get "type" }} +{{ $language := .Get "language" }} +{{ $options := .Get "options" }} + +
+ {{- if $url -}} + {{- $resource := resources.GetRemote $url -}} + {{- $content := $resource.Content -}} + {{- if $language -}} + {{- highlight $content $language (default "linenos=table" $options) -}} + {{- else if eq $type "html" -}} + {{- $content | safeHTML -}} + {{- else -}} + {{- $content -}} + {{- end -}} + {{- else -}} + {{- if $language -}} + {{- highlight ($file | readFile) $language (default "linenos=table" $options) -}} + {{- else if eq $type "html" -}} + {{- $file | readFile | safeHTML -}} + {{- else if eq $type "page" -}} + {{- with .Site.GetPage $file }}{{ .Content }}{{ end -}} + {{- else -}} + {{- $file | readFile | $.Page.RenderString -}} + {{- end -}} + {{- end -}} +
\ No newline at end of file