hugo: don't rewrite index.md links in render hook

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-09-10 15:29:49 +02:00
parent 6e4790e291
commit 554aaabb1f
1 changed files with 2 additions and 13 deletions

View File

@ -17,17 +17,6 @@
{{ end }}
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>
{{- else -}}
{{/* check if the file links to index.md */}}
{{- if (strings.FindRE `([^_]|^)index.md` $url 1) -}}
<a
class="link"
href="{{ ref page (strings.Replace $url "index.md" "_index.md") }}"
>{{ .Text | safeHTML }}</a
>
{{- else -}}
{{/* relative link, use ref */}}
<a class="link" href="{{ ref page $url }}"
>{{ .Text | safeHTML }}</a
>
{{- end -}}
{{/* relative link, use ref */}}
<a class="link" href="{{ ref page $url }}">{{ .Text | safeHTML }}</a>
{{- end -}}