another try

This commit is contained in:
2026-03-28 05:04:01 +00:00
parent 8a57cbf8a5
commit cab796c749

View File

@@ -6,17 +6,22 @@
{{- $context := .context -}}
{{/* Map absolute private paths to the relative content mount point */}}
{{- $path = replace $path "/srv/docs/private/" "private/" -}}
{{- $path = replace $path "/srv/docs/private/" "" -}}
{{- $path = trim $path "/" -}}
{{/* Try multiple variations to find the Page */}}
{{- $p := $context.Site.GetPage $path -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" $path) }}{{ end -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (strings.TrimSuffix ".md" $path) }}{{ end -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" (strings.TrimSuffix ".md" $path)) }}{{ end -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (lower $path) }}{{ end -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (lower (strings.TrimSuffix ".md" $path)) }}{{ end -}}
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" (lower (strings.TrimSuffix ".md" $path))) }}{{ end -}}
{{/* 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 -}}
@@ -24,7 +29,8 @@
{{/* Fallback to readFile - check multiple path variations */}}
{{- $found := false -}}
{{- $content := "" -}}
{{- $pathsToTry := slice $path (printf "content/%s" $path) (printf "/%s" $path) -}}
{{- $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 .) -}}