adding partials for <include>
This commit is contained in:
17
layouts/partials/include.html
Normal file
17
layouts/partials/include.html
Normal file
@@ -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 -}}
|
||||
<p class="text-red-500 font-bold">[Include Error: File "{{ $path }}" not found]</p>
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user