diff options
author | Thedro Neely <thedroneely@gmail.com> | 2020-01-16 21:55:17 -0500 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2020-01-16 21:55:17 -0500 |
commit | 66e5c95d708749eb14b81dfbdb226522440bc3ea (patch) | |
tree | 7df548475948221913c3252eadf3ad315f3ed135 /generators/hugo/themes/tdro/layouts/_default/_markup | |
parent | b297d9c05a7b93df1ed10cbfabb646825f8a1b5d (diff) | |
download | thedroneely.com-66e5c95d708749eb14b81dfbdb226522440bc3ea.tar.gz thedroneely.com-66e5c95d708749eb14b81dfbdb226522440bc3ea.tar.bz2 thedroneely.com-66e5c95d708749eb14b81dfbdb226522440bc3ea.zip |
generators/hugo/layouts/_default: Add markup hooks
Add render link hook
Diffstat (limited to 'generators/hugo/themes/tdro/layouts/_default/_markup')
-rw-r--r-- | generators/hugo/themes/tdro/layouts/_default/_markup/render-link.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/_markup/render-link.html b/generators/hugo/themes/tdro/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..77c8cc0 --- /dev/null +++ b/generators/hugo/themes/tdro/layouts/_default/_markup/render-link.html @@ -0,0 +1,10 @@ +{{ $link := .Destination }} +{{ $isRemote := strings.HasPrefix $link "http" }} +{{- if not $isRemote -}} +{{ $url := urls.Parse .Destination }} +{{- if $url.Path -}} +{{ $fragment := "" }} +{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} +{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}} +{{- end -}} +<a rel="noopener" href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a> |