<?php
require_once __DIR__ . '/yamanlar_inc.php';

header('Content-Type: application/xml; charset=utf-8');

$pages = db()->fetchAll("SELECT slug, updated_at FROM pages WHERE is_published = 1");
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc><?= SITE_URL ?>/</loc>
        <priority>1.0</priority>
    </url>
    <?php foreach ($pages as $page): ?>
    <?php if ($page['slug'] !== 'home'): ?>
    <url>
        <loc><?= SITE_URL ?>/<?= secureText($page['slug']) ?></loc>
        <priority>0.8</priority>
        <lastmod><?= date('c', strtotime($page['updated_at'])) ?></lastmod>
    </url>
    <?php endif; ?>
    <?php endforeach; ?>
</urlset>
