website/layouts/_default/_markup/render-link.html
liuboaibc c6e8b117ac create pdf
Signed-off-by: liuboaibc <kukudehero@gmail.com>
2021-07-08 11:02:28 +08:00

11 lines
533 B
HTML

{{ if strings.HasPrefix .Destination "http" }}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }} target="_blank" rel="noopener noreferrer">{{ .Text }}</a>
{{ else }}
{{ $page := .Page.GetPage .Destination }}
{{ if $page }}
<a href="#{{ $page.UniqueID }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
{{ else}}
{{ $page := .Page.GetPage (substr .Destination 3 -1) }}
<a href="#{{ $page.UniqueID }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
{{ end }}
{{ end }}