<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <!-- Halaman Utama -->
    <url>
        <loc>https://ocrentcarbanjarmasin.com/</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
    
    <!-- Halaman Statis -->
    <url>
        <loc>https://ocrentcarbanjarmasin.com/about</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/cars</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.9</priority>
    </url>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/artikel</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.7</priority>
    </url>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/contact</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.6</priority>
    </url>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/privacy</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.3</priority>
    </url>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/terms</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.3</priority>
    </url>

    <!-- Detail Mobil (dinamis dari JSON) -->
    <?php 
    $cars = json_decode(file_get_contents(__DIR__ . '/data/cars.json'), true) ?? [];
    foreach ($cars as $c): 
    ?>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/mobil/<?= $c['slug'] ?? 'detail-' . $c['id'] ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    <?php endforeach; ?>

    <!-- Detail Artikel (dinamis dari JSON) -->
    <?php 
    $articles = json_decode(file_get_contents(__DIR__ . '/data/articles.json'), true) ?? [];
    foreach ($articles as $a): 
    ?>
    <url>
        <loc>https://ocrentcarbanjarmasin.com/artikel/<?= $a['slug'] ?? 'artikel-' . $a['id'] ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.6</priority>
    </url>
    <?php endforeach; ?>
</urlset>