From 89aab9cd99e94b865fe250f1755635db16a34377 Mon Sep 17 00:00:00 2001 From: Frank Lin Date: Fri, 4 Aug 2023 14:17:13 -0700 Subject: [PATCH] Open external links in separate tab; show a SVG icon after the external link. --- assets/css/_base.scss | 9 +++++++++ layouts/_default/_markup/render-link.html | 5 +++++ static/images/external-link.svg | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 layouts/_default/_markup/render-link.html create mode 100644 static/images/external-link.svg diff --git a/assets/css/_base.scss b/assets/css/_base.scss index 80de9843..f6b0db7f 100644 --- a/assets/css/_base.scss +++ b/assets/css/_base.scss @@ -27,6 +27,15 @@ a { } } +a.external { + background-image: url(/images/external-link.svg?uNJ); + background-position: center right; + background-repeat: no-repeat; + background-size: 0.857em; + padding-right: 1em; +} + + // Browsers seem to use a smaller default font-size with monospaced code // blocks (like 80% of the size of normal text) and that looks pretty bad with // small inline code-blocks in the middle of normal text (mainly because of diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 00000000..611b4856 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,5 @@ +{{ .Text | safeHTML }} diff --git a/static/images/external-link.svg b/static/images/external-link.svg new file mode 100644 index 00000000..b34b9c1c --- /dev/null +++ b/static/images/external-link.svg @@ -0,0 +1,5 @@ + + +external link + +