Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jakewies/hugo-theme-codex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Wiesler <jakewiesler@gmail.com>2020-10-18 18:22:53 +0300
committerGitHub <noreply@github.com>2020-10-18 18:22:53 +0300
commitac5c699d85ce398fb42913a5212dbeb8971e157e (patch)
treeb450c08effecc4b41322cd465b400f1239a0629f
parentf76ad38a6566755ce71d9bbde38bdc5af9e6f99b (diff)
parent2a4154930948331229ecb0941132dfc701340dca (diff)
Merge pull request #121 from SanchithHegde/hooks-new-tab
layouts: Add markdown render hook to open links in new tab
-rw-r--r--layouts/_default/_markup/render-link.html4
1 files changed, 4 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
new file mode 100644
index 0000000..d445e88
--- /dev/null
+++ b/layouts/_default/_markup/render-link.html
@@ -0,0 +1,4 @@
+<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}" {{ end }}
+ {{ if strings.HasPrefix .Destination "mailto" }} target="_blank" {{ end }}
+ {{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noreferrer noopener" {{ end }}
+>{{ .Text | safeHTML }}</a>