Skip to content
Snippets Groups Projects
Verified Commit e96dcfb4 authored by Lars Bilke's avatar Lars Bilke
Browse files

[web] Fixed image links in MR preview.

Fixes #3021. At least for images in page bundles.
parent 1ff238b3
No related branches found
No related tags found
No related merge requests found
{{ $url := .Destination }}
{{ if eq hugo.Environment "staging" }}
{{ $imageFile := index (split .Destination "#") 0 }}
{{ $imageResource := .Page.Resources.GetMatch ($imageFile) }}
{{ with $imageResource }}
{{ $url = .RelPermalink }}
{{ end }}
{{ end }}
{{ if .Title }}
<figure>
<img class="m-auto" src="{{ .Destination | safeURL }}" alt="{{ .Text }}">
<img class="m-auto" src="{{ $url | safeURL }}" alt="{{ .Text }}">
<figcaption>{{ .Title | safeHTML | markdownify }}</figcaption>
</figure>
{{ else }}
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}">
<img src="{{ $url | safeURL }}" alt="{{ .Text }}">
{{ end }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment