images

// JavaScript to automatically open specific Ghost toggle cards on page load. // 1. Configuration: List the exact titles of the toggle cards you want open by default. // Titles are case-sensitive and must match the text inside the tag exactly. const titlesToOpen = [ "FAQ: How do I get started?", "Advanced Settings (Default Open)", "Important Update Notice" // Add all the specific titles you want to be open here ]; // 2. Main execution function, wrapped in a DOMContentLoaded listener document.addEventListener('DOMContentLoaded', () => { // Select all
elements that are part of the standard Ghost toggle card. const toggleDetails = document.querySelectorAll('.kg-toggle-card details'); // Use a Set for faster title lookup const openTitlesSet = new Set(titlesToOpen.map(title => title.trim())); toggleDetails.forEach(detailsElement => { // Find the element which holds the title const summaryElement = detailsElement.querySelector('summary'); if (summaryElement) { // Get the cleaned-up title text const title = summaryElement.textContent.trim(); // Check if this title is in our list of titles to open if (openTitlesSet.has(title)) { // If the title matches, set the 'open' attribute on the
element // This forces the toggle card to be expanded. detailsElement.setAttribute('open', ''); // Optional: Log which toggle was opened (useful for debugging) // console.log(`Opened toggle card: "${title}"`); } } }); });