{{/* Partial: include.html Handles including external Markdown files and rendering them. */}} {{- $path := .path -}} {{- $context := .context -}} {{/* Map absolute private paths to the relative content mount point */}} {{- $path = replace $path "/srv/docs/private/" "" -}} {{- $path = trim $path "/" -}} {{/* Try multiple variations to find the Page */}} {{/* CI environment flattens everything into content root, so "private/bazel/PRD.md" becomes "bazel/PRD.md" */}} {{- $p := "" -}} {{- $variations := slice $path (printf "private/%s" $path) (replace $path "private/" "") -}} {{- range $v := $variations -}} {{- if not $p }}{{ $p = $context.Site.GetPage $v }}{{ end -}} {{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" $v) }}{{ end -}} {{- if not $p }}{{ $p = $context.Site.GetPage (strings.TrimSuffix ".md" $v) }}{{ end -}} {{- if not $p }}{{ $p = $context.Site.GetPage (lower $v) }}{{ end -}} {{- if not $p }}{{ $p = $context.Site.GetPage (lower (strings.TrimSuffix ".md" $v)) }}{{ end -}} {{- end -}} {{- if $p -}} {{- $p.Content -}} {{- else -}} {{/* Fallback to readFile - check multiple path variations */}} {{- $found := false -}} {{- $content := "" -}} {{- $absPrivate := printf "/srv/docs/private/%s" (replace $path "private/" "") -}} {{- $pathsToTry := slice $path (printf "content/%s" $path) (printf "private/%s" $path) (printf "content/private/%s" $path) $absPrivate -}} {{- range $pathsToTry -}} {{- if and (not $found) (fileExists .) -}} {{- $content = readFile . -}} {{- $found = true -}} {{- end -}} {{- end -}} {{- if $found -}} {{/* Strip frontmatter if it exists */}} {{- if (findRE "^---" $content) -}} {{- $content = replaceRE "^(?s)---.*?---[\\r\\n]*" "" $content -}} {{- end -}} {{- $context.RenderString $content -}} {{- else -}} {{- warnf "Include file not found: %s" $path -}}

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

{{- end -}} {{- end -}}