mirror of https://github.com/docker/docs.git
hugo: add support for absolute markdown links
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
ac4d311f60
commit
b21e0573af
|
@ -11,7 +11,10 @@
|
|||
{{- partialCached "icon" "open_in_new" "open_in_new" -}}
|
||||
</span></a>
|
||||
{{- else if (strings.HasPrefix $url "/") -}}
|
||||
{{/* absolute link, use url as-is */}}
|
||||
{{ if (strings.HasSuffix (urls.Parse $url).Path ".md") }}
|
||||
{{/* abs path to markdown file, use ref */}}
|
||||
{{ $url = (ref .Page $url) }}
|
||||
{{ end }}
|
||||
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>
|
||||
{{- else -}}
|
||||
{{/* check if the file links to index.md */}}
|
||||
|
|
Loading…
Reference in New Issue