mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-21 12:40:39 +00:00
fix: dont apply relURL function to remote urls in render-link template
This commit is contained in:
parent
ece9d46a3e
commit
673dc72be0
@ -3,5 +3,6 @@ title: "Get in touch"
|
||||
---
|
||||
|
||||
- **E-Mail:** <!-- spellchecker-disable -->mail [ett] example.com<!-- spellchecker-enable -->
|
||||
- **Mailto:** [contact@example.com](mailto:contact@example.com)
|
||||
- **Matrix:** @john:example.com
|
||||
- **XMPP:** john@example.com
|
||||
|
@ -1,2 +1,7 @@
|
||||
{{ $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") }}
|
||||
<a class="gblog-post__link{{ if $raw }}--raw{{ end }}" href="{{ .Destination | safeURL | relURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
|
||||
{{- $isRemote:= or (in .Destination ":") ( hasPrefix .Destination "//") -}}
|
||||
{{- $destination := .Destination | safeURL -}}
|
||||
{{- if not $isRemote -}}
|
||||
{{- $destination = $destination | relURL -}}
|
||||
{{- end -}}
|
||||
<a class="gblog-post__link{{ if $raw }}--raw{{ end }}" href="{{ $destination }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
|
Loading…
Reference in New Issue
Block a user