diff --git a/astro.config.mjs b/astro.config.mjs index f2875a6..5cdaef5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,12 +5,20 @@ import starlightThemeGalaxy from 'starlight-theme-galaxy'; import starlightSidebarTopics from 'starlight-sidebar-topics'; import starlightLinksValidator from 'starlight-links-validator'; -// https://astro.build/config export default defineConfig({ site: 'https://beta.nextftc.dev', integrations: [ starlight({ title: 'NextFTC', + head: [ + { + //Look at /public/scripts/external-links thats where the thing happens + tag: 'script', + attrs: { + src: '/scripts/external-links.js', + }, + }, + ], logo: { light: './src/assets/nextftc-banner-light.png', dark: './src/assets/nextftc-banner-dark.png', @@ -73,4 +81,4 @@ export default defineConfig({ ] }), ], -}); +}); \ No newline at end of file diff --git a/public/scripts/external-links.js b/public/scripts/external-links.js new file mode 100644 index 0000000..e0b7cb8 --- /dev/null +++ b/public/scripts/external-links.js @@ -0,0 +1,6 @@ +document.addEventListener('DOMContentLoaded', () => { + document.querySelectorAll('a[href^="http"]').forEach((link) => { + link.setAttribute('target', '_blank'); + link.setAttribute('rel', 'noopener noreferrer'); + }); +});`` \ No newline at end of file