aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-10-28 16:15:25 +0200
committerOscar Najera <hi@oscarnajera.com>2023-10-28 16:15:25 +0200
commit90967ae85f93ddf02485f4dc1b07789b8ef57b64 (patch)
treef10eb79dc952eeedbfa05f0759fda65bd0d7f8f1
parent578d288907f178de8a0be1a631bca6b4f46a9242 (diff)
downloadhugo-minimalist-theme-90967ae85f93ddf02485f4dc1b07789b8ef57b64.tar.gz
hugo-minimalist-theme-90967ae85f93ddf02485f4dc1b07789b8ef57b64.tar.bz2
hugo-minimalist-theme-90967ae85f93ddf02485f4dc1b07789b8ef57b64.zip
External links
-rw-r--r--assets/scss/style.scss12
-rw-r--r--layouts/_default/_markup/render-link.html11
2 files changed, 23 insertions, 0 deletions
diff --git a/assets/scss/style.scss b/assets/scss/style.scss
index 7964535..6f4c29e 100644
--- a/assets/scss/style.scss
+++ b/assets/scss/style.scss
@@ -186,6 +186,18 @@ blockquote {
@extend .link, .ph1, .w3-text-theme;
}
+ a[href^="http"]::after {
+ content: "";
+ width: 11px;
+ height: 11px;
+ margin-left: 4px;
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: contain;
+ display: inline-block;
+ }
+
p code {
@extend .ph1, .blue, .fw5;
}
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
new file mode 100644
index 0000000..7031af3
--- /dev/null
+++ b/layouts/_default/_markup/render-link.html
@@ -0,0 +1,11 @@
+{{- /* A Hugo Markdown render hook to parse links, opening external links in new tabs. */ -}}
+<a
+ href="{{ .Destination | safeURL }}"
+ {{ with .Title }}
+ title="{{ . }}"
+ {{ end }}
+ {{ if strings.HasPrefix .Destination "http" }}
+ target="_blank" rel="noopener"
+ {{ end }}
+ >{{ .Text | safeHTML }}</a
+>