const htmlFiles = ["contact.htm","index.htm"]; document.addEventListener("DOMContentLoaded", function () { const menuContainer = document.getElementById("menu-container"); console.log("📂 HTML Files Found:", htmlFiles); // Get current file name const currentPage = window.location.pathname.split("/").pop(); console.log("📄 Current Page:", currentPage); // Generate the menu menuContainer.innerHTML = ` `; console.log("✅ Menu Bar Updated!"); }); // ✅ Move this script OUTSIDE innerHTML so it executes properly document.addEventListener("DOMContentLoaded", function () { let currentPage = window.location.pathname.split("/").pop(); // Get current .htm page if (!currentPage || !currentPage.endsWith(".htm")) { currentPage = "index.htm"; // Default fallback } document.getElementById("edit-page-link").href = "lib/dynpage/?file=" + currentPage; console.log("🔗 Edit Page Link Updated:", document.getElementById("edit-page-link").href); });