From 9caa7b67a0d0f15b2e684bdb4fb65eee005ed08e Mon Sep 17 00:00:00 2001 From: Dirk Heilig Date: Tue, 9 Jan 2024 13:24:44 +0100 Subject: [PATCH] add external link indicator --- themes/hugo-theme-flat/static/css/style.css | 7 ++++++- themes/hugo-theme-flat/static/js/href_handling.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/themes/hugo-theme-flat/static/css/style.css b/themes/hugo-theme-flat/static/css/style.css index 4a16ddb..b019cd4 100644 --- a/themes/hugo-theme-flat/static/css/style.css +++ b/themes/hugo-theme-flat/static/css/style.css @@ -120,7 +120,6 @@ html { /**************************************************************/ /* approximately set up the layout of header, footer and main */ /**************************************************************/ - body { display: flex; flex-direction: column; @@ -139,6 +138,12 @@ body { margin-bottom: var(--len-5); } +a.external:after{ + /*edd external icon to external link as :after with unicode symbol*/ + content: "⮺"; + +} + .main-wrapper { display: flex; flex-wrap: wrap; } .main-wrapper > * { height: fit-content; } diff --git a/themes/hugo-theme-flat/static/js/href_handling.js b/themes/hugo-theme-flat/static/js/href_handling.js index ebff720..1704170 100644 --- a/themes/hugo-theme-flat/static/js/href_handling.js +++ b/themes/hugo-theme-flat/static/js/href_handling.js @@ -11,8 +11,10 @@ document.querySelectorAll('a').forEach(function(element) { link.setAttribute('href', prefetchUrl); link.setAttribute('as', 'document'); document.head.appendChild(link); + element.classList.add("internal"); }else { element.setAttribute("target", "_blank"); + element.classList.add("external"); } }) }); \ No newline at end of file