fix(render-image): use page resources for relative images in i18n page bundles (#938)
* fix(layout): Images missing (404) in multilingual (i18n) Page Bundles due to Markdown render hook * fix(layout): Changed to .PageInner based on PR review to support included shortcodes correctly * refactor(render-image): simplify i18n page bundle resource lookup Use single PathUnescape + TrimPrefix expression instead of six Get attempts; keep same behavior for bundle images and fallback. * refactor: simplify resource path handling in render-image.html * Add comment for multilingual permalink handling Added comment for multilingual permalink resolution in render-image.html --------- Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:
@@ -23,11 +23,19 @@
|
|||||||
{{/* Images under static directory */}}
|
{{/* Images under static directory */}}
|
||||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else if and $isPage (not $startsWithRelative) -}}
|
{{- else -}}
|
||||||
{{/* Images that are sibling to the individual page file */}}
|
{{/* Resolve page bundle resource for multilingual permalink */}}
|
||||||
|
{{- with .PageInner.Resources.Get (strings.TrimPrefix "./" $url.Path) -}}
|
||||||
|
{{- $query := cond $url.RawQuery (printf "?%s" $url.RawQuery) "" -}}
|
||||||
|
{{- $fragment := cond $url.Fragment (printf "#%s" $url.Fragment) "" -}}
|
||||||
|
{{- $dest = printf "%s%s%s" .RelPermalink $query $fragment -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- if and $isPage (not $startsWithRelative) -}}
|
||||||
{{ $dest = (printf "../%s" $dest) }}
|
{{ $dest = (printf "../%s" $dest) }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- $attributes := "" -}}
|
{{- $attributes := "" -}}
|
||||||
{{- range $key, $value := .Attributes -}}
|
{{- range $key, $value := .Attributes -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user