another try
This commit is contained in:
@@ -6,17 +6,22 @@
|
|||||||
{{- $context := .context -}}
|
{{- $context := .context -}}
|
||||||
|
|
||||||
{{/* Map absolute private paths to the relative content mount point */}}
|
{{/* 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 "/" -}}
|
{{- $path = trim $path "/" -}}
|
||||||
|
|
||||||
{{/* Try multiple variations to find the Page */}}
|
{{/* Try multiple variations to find the Page */}}
|
||||||
{{- $p := $context.Site.GetPage $path -}}
|
{{/* CI environment flattens everything into content root, so "private/bazel/PRD.md" becomes "bazel/PRD.md" */}}
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" $path) }}{{ end -}}
|
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (strings.TrimSuffix ".md" $path) }}{{ end -}}
|
{{- $p := "" -}}
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" (strings.TrimSuffix ".md" $path)) }}{{ end -}}
|
{{- $variations := slice $path (printf "private/%s" $path) (replace $path "private/" "") -}}
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (lower $path) }}{{ end -}}
|
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (lower (strings.TrimSuffix ".md" $path)) }}{{ end -}}
|
{{- range $v := $variations -}}
|
||||||
{{- if not $p }}{{ $p = $context.Site.GetPage (printf "/%s" (lower (strings.TrimSuffix ".md" $path))) }}{{ end -}}
|
{{- 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 -}}
|
{{- if $p -}}
|
||||||
{{- $p.Content -}}
|
{{- $p.Content -}}
|
||||||
@@ -24,7 +29,8 @@
|
|||||||
{{/* Fallback to readFile - check multiple path variations */}}
|
{{/* Fallback to readFile - check multiple path variations */}}
|
||||||
{{- $found := false -}}
|
{{- $found := false -}}
|
||||||
{{- $content := "" -}}
|
{{- $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 -}}
|
{{- range $pathsToTry -}}
|
||||||
{{- if and (not $found) (fileExists .) -}}
|
{{- if and (not $found) (fileExists .) -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user