<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

    <!-- Homepage -->
    <url>
        <loc>https://impactjourney.pt/</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
    </url>

    <!-- Services Pages -->
    <url>
        <loc>https://impactjourney.pt/#servicos</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>

    <!-- Projetos Pages -->
    <url>
        <loc>https://impactjourney.pt/#projetos</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.9</priority>
    </url>

    <!-- Contact Page -->
    <url>
        <loc>https://impactjourney.pt/#contacto</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
    </url>

    <!-- Dynamic Projetos Items -->
    <?php
    // Add projetos gallery items dynamically
    $galleryPath = 'imgs/galeria/';
    if (is_dir($galleryPath)) {
        $folders = scandir($galleryPath);
        foreach ($folders as $folder) {
            if ($folder !== '.' && $folder !== '..' && is_dir($galleryPath . $folder)) {
                $folderName = strtolower(str_replace(' ', '-', $folder));
                echo "    <url>\n";
                echo "        <loc>https://impactjourney.pt/#projetos-" . htmlspecialchars($folderName) . "</loc>\n";
                echo "        <lastmod>" . date('Y-m-d') . "</lastmod>\n";
                echo "        <changefreq>monthly</changefreq>\n";
                echo "        <priority>0.6</priority>\n";
                echo "    </url>\n";
            }
        }
    }
    ?>

</urlset>
