more docs + link fixing

This commit is contained in:
jackyzha0
2021-07-18 15:19:58 -04:00
parent 6896cb007b
commit 92d18b1ee5
10 changed files with 125 additions and 16 deletions

View File

@ -1,2 +1,7 @@
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
<a href="{{ if (hasPrefix $trimmed "/") }}{{ $trimmed }}{{ else }}{{ print "/" $trimmed }}{{ end }}" rel="noopener">{{ .Text | safeHTML }}</a>
{{$external := strings.HasPrefix $trimmed "http" }}
{{ if $external }}
<a href="{{ $trimmed }}" rel="noopener">{{ .Text | safeHTML }}</a>
{{else}}
<a href="{{ if (hasPrefix $trimmed "/") }}{{ $trimmed }}{{ else }}{{ print "/" $trimmed }}{{ end }}" rel="noopener">{{ .Text | safeHTML }}</a>
{{end}}