In some cases I use chapters headings to redirect elsewhere, to not make the page too long.
So it gets like this:
## Exosomes and viruses: two sides of the same coin: [⇐](virus-exosome-en)
Here is the part of render-link.html that creates the destination ($destination)
part
{{- $destination := .Destination }}
{{if eq $destination "add_ref"}}
{{.Text}}
{{else}}
{{- $isRemote := or (or (in $destination ":") (strings.HasPrefix $destination "//")) (strings.HasPrefix $destination "//") }}
{{- if $isRemote }}
{{ .Page.Scratch.Add "Sources" (slice (dict "url" .Destination ".Text" .Title)) }}
{{- else }}
{{- $url := urls.Parse .Destination }}
{{- $path := strings.TrimSuffix "/_index.md" $url.Path }}
{{- $path = strings.TrimSuffix "/_index" $path }}
{{- $path = strings.TrimSuffix ".md" $path }}
{{- $page := site.GetPage $path }}
{{- if $page }}
{{- $destination = $page.RelPermalink }}
{{- if $url.Fragment }}
{{- $destination = print $destination "#" $url.Fragment }}
{{- end }}
{{- else if fileExists (print .Page.File.Dir .Destination) }}
<!-- Nothing -->
{{- else -}}
{{ with resources.Get .Destination }}
{{ $destination = .RelPermalink}}
{{ end}}
{{- end }}
{{- end }}
But .TableOfContent bypasses render-link.html completely ! To me this is a dysfunction. It reads href=virus-exosome-en
, which would obviously be the address of a page ressource.
How do I avoid that ?