From 86eb68a1e783b729ca1ad9c0a9c6baa7c693feb9 Mon Sep 17 00:00:00 2001 From: "David B. Kinder" Date: Wed, 17 Jun 2020 06:35:37 -0700 Subject: [PATCH] doc: open external links in new tab As a UX improvement, use a separate tab when opening links to external sites (use the same tab for internal links). Also, use rel=noopener attribute to improve security when linking to external sites. Signed-off-by: David B. Kinder --- doc/static/acrn-custom.css | 7 +++++++ doc/static/acrn-custom.js | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/static/acrn-custom.css b/doc/static/acrn-custom.css index 044383d0a..444d5634a 100644 --- a/doc/static/acrn-custom.css +++ b/doc/static/acrn-custom.css @@ -299,3 +299,10 @@ div.numbered-step h2::before { .rst-content .toctree-l1 > a { font-weight: bold; } + +/* add icon on external links */ +a.reference.external::after { + font-family: 'FontAwesome'; + font-size: 80%; + content: " \f08e"; +} diff --git a/doc/static/acrn-custom.js b/doc/static/acrn-custom.js index e0e235899..f602e1d6f 100644 --- a/doc/static/acrn-custom.js +++ b/doc/static/acrn-custom.js @@ -1,7 +1,11 @@ -/* tweak logo link */ +/* Extra acrn-specific javascript */ $(document).ready(function(){ - $( ".icon-home" ).attr("href", "https://projectacrn.org/"); + /* tweak logo link to the marketing site instead of doc site */ + $( ".icon-home" ).attr({href: "https://projectacrn.org/", target: "_blank"}); + + /* open external links in a new tab */ + $('a[class*=external]').attr({target: '_blank', rel: 'noopener'}); }); /* Global site tag (gtag.js) - Google Analytics */