From 319153c8c29b70fb385b4067d8e13270b12e4738 Mon Sep 17 00:00:00 2001 From: wompmacho Date: Sat, 28 Mar 2026 02:00:49 +0000 Subject: [PATCH] adding partials for --- layouts/partials/include.html | 17 +++++++++++++++++ layouts/shortcodes/include.html | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 layouts/partials/include.html create mode 100644 layouts/shortcodes/include.html diff --git a/layouts/partials/include.html b/layouts/partials/include.html new file mode 100644 index 0000000..5633f33 --- /dev/null +++ b/layouts/partials/include.html @@ -0,0 +1,17 @@ +{{/* + Partial: include.html + Handles including external Markdown files and rendering them. + Parameters: + - context: The Page context (required for RenderString) + - path: Path to the file, relative to the project root +*/}} +{{- $path := .path -}} +{{- $context := .context -}} + +{{- if fileExists $path -}} + {{- $content := readFile $path -}} + {{- $context.RenderString $content -}} +{{- else -}} + {{- warnf "Include file not found: %s" $path -}} +

[Include Error: File "{{ $path }}" not found]

+{{- end -}} diff --git a/layouts/shortcodes/include.html b/layouts/shortcodes/include.html new file mode 100644 index 0000000..d56ac5e --- /dev/null +++ b/layouts/shortcodes/include.html @@ -0,0 +1,10 @@ +{{- $path := .Get 0 -}} +{{- if not $path -}} + {{- $path = .Get "src" -}} +{{- end -}} +{{- if $path -}} + {{- partial "include.html" (dict "context" .Page "path" $path) -}} +{{- else -}} + {{- warnf "Shortcode 'include' called without path or src attribute." -}} +

[Include Error: No path provided]

+{{- end -}}