<?php
header("Content-Type: application/xml; charset=utf-8");

$base = "https://www.max77.id";

// list manual halaman utama (biar sesuai punyamu)
$pages = [
    "",
    "/max77login/",
    "/linkmax77/",
    "/panduan/",
    "/wilayahmax77/",
    "/privasi/"
];

// scan folder blog (opsional, kalau ada)
$blogFiles = glob(__DIR__ . "/blog/*.html");

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<?php
// halaman utama
foreach ($pages as $page) {
    echo "<url>
        <loc>$base$page</loc>
        <lastmod>" . date("c") . "</lastmod>
        <priority>" . ($page == "" ? "1.0" : "0.8") . "</priority>
    </url>";
}

// auto tambah artikel dari folder /blog
foreach ($blogFiles as $file) {
    $url = str_replace(__DIR__, '', $file);
    $url = str_replace('\\', '/', $url);

    echo "<url>
        <loc>$base$url</loc>
        <lastmod>" . date("c", filemtime($file)) . "</lastmod>
        <priority>0.7</priority>
    </url>";
}
?>

</urlset>