// ===== SITEMAP GENERATOR (run once or in admin panel) =====
function generateStorySitemap() {
    if (!featuredStories.length) {
        showToast('No stories to generate sitemap');
        return;
    }
    const baseUrl = 'https://dealstreets.xyz';
    let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
    xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
    featuredStories.forEach(story => {
        const lastmod = story.createdAt ? new Date(story.createdAt).toISOString().split('T')[0] : new Date().toISOString().split('T')[0];
        xml += `  <url>\n    <loc>${baseUrl}/?story=${story.id}</loc>\n`;
        xml += `    <lastmod>${lastmod}</lastmod>\n`;
        xml += `    <changefreq>monthly</changefreq>\n    <priority>0.8</priority>\n  </url>\n`;
    });
    xml += '</urlset>';

    // Show in a popup so you can copy it
    const win = window.open('', '_blank');
    win.document.write('<pre style="background:#111;color:#0f0;padding:20px;font-size:12px;white-space:pre-wrap;word-break:break-all;">' + xml + '</pre>');
    win.document.title = 'Sitemap for DealStreets';
}