<?php
header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://www.oreg.fr/</loc>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>

    <?php
    // Lecture automatique de ton fichier data.json pour lister tes vidéos/récits
    $fichierJson = 'data.json';
    if (file_exists($fichierJson)) {
        $contenu = file_get_contents($fichierJson);
        $donnees = json_decode($contenu, true);

        if (is_array($donnees)) {
            foreach ($donnees as $index => $item) {
                // On génère une URL propre pour chaque contenu ou modal (via ancre ou ID)
                // Par exemple, si tu utilises un système d'ID ou d'index dans ton JS :
                echo '    <url>' . PHP_EOL;
                echo '        <loc>https://www.oreg.fr/#item-' . $index . '</loc>' . PHP_EOL;
                echo '        <changefreq>weekly</changefreq>' . PHP_EOL;
                echo '        <priority>0.8</priority>' . PHP_EOL;
                echo '    </url>' . PHP_EOL;
            }
        }
    }
    ?>
</urlset>