document.addEventListener("DOMContentLoaded", () => { const currentHost = window.location.hostname; const links = document.querySelectorAll("a"); links.forEach((link) => { if (link.hostname && link.hostname !== currentHost) { link.setAttribute("target", "_blank"); link.setAttribute("rel", "noopener noreferrer"); } }); });