{{ $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 }}
{{ .Title | safeHTML | markdownify }}
{{ else }}
{{ end }}