I’d like to continue using relative markdown link and image syntax in my editor, which allows me to navigate to linked content and view local images as I write.
[link to post2](./post2)
![](../images/image1]
In Hugo, I made use of their markdown render hooks to achieve this:
{{ $link := .Destination }}
{{ $isRemote := strings.HasPrefix $link "http" }}
{{- if not $isRemote -}}
{{ $url := urls.Parse .Destination }}
{{- if $url.Path -}}
{{ $fragment := "" }}
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}}
{{- end -}}
<a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
…but I’m not sure how to do the same in Zola.
I’ve thought about using filters/replace but haven’t been able to figure it yet.
I suppose I could get my own fork and roll back to the earlier use of “./” for internal links, but I was hoping there’d be a cleaner way.
I know this question was brought up earlier in 2020, but not sure if anyone’s found a solution that works for them yet.