diff --git a/docs/javascripts/external-links.js b/docs/javascripts/external-links.js
new file mode 100644
index 0000000..de1d19e
--- /dev/null
+++ b/docs/javascripts/external-links.js
@@ -0,0 +1,40 @@
+// Open External Links in New Tab
+
+document.addEventListener('DOMContentLoaded', domContentLoaded)
+
+const observer = new MutationObserver(mutationObserver)
+
+function domContentLoaded() {
+ for (const el of document.querySelectorAll('a')) {
+ processLink(el)
+ }
+ observer.observe(document, {
+ childList: true,
+ subtree: true,
+ })
+}
+
+function mutationObserver(mutationList) {
+ // console.debug('mutationList:', mutationList)
+ for (const mutation of mutationList) {
+ // console.debug('mutation:', mutation)
+ mutation.addedNodes.forEach((el) => {
+ // console.debug('el:', el)
+ if (el.classList?.contains('md-container')) {
+ // console.debug('md-container:', el)
+ for (const el of document.querySelectorAll('a')) {
+ processLink(el)
+ }
+ }
+ })
+ }
+}
+
+function processLink(el) {
+ // console.debug('checking el:', el)
+ if (el.host !== window.location.host) {
+ // console.debug('updating el:', el)
+ el.target = '_blank'
+ el.rel = 'noopener'
+ }
+}
diff --git a/zensical.toml b/zensical.toml
index a6a7e2b..4fb231f 100644
--- a/zensical.toml
+++ b/zensical.toml
@@ -12,9 +12,9 @@ site_url = "https://zensical-action.cssnr.com/"
# https://zensical.org/docs/setup/basics/#copyright
copyright = """
-Zensical Action Docs
+Zensical Action Docs
-Built with Zensical
+Built with Zensical
"""
# https://zensical.org/docs/setup/navigation/
@@ -29,7 +29,7 @@ nav = [
#extra_css = ["assets/stylesheets/extra.css"]
# https://zensical.org/docs/customization/#additional-javascript
-#extra_javascript = ["assets/javascript/extra.js"]
+extra_javascript = ["javascripts/external-links.js"]
# ----------------------------------------------------------------------------
# Section for configuring theme options