<?php
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/data.php';
header('Content-Type: application/xml; charset=UTF-8');
$paths = ['/', '/hot/', '/observe/', '/topics/', '/authors/', '/faq/', '/contact/', '/about/', '/data-view/'];
foreach ($articles as $article) {
    $paths[] = '/article/' . $article['slug'] . '/';
}
$ns = 'http://' . 'www' . '.' . 'sitemaps' . '.' . 'org' . '/schemas/sitemap/0.9';
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="<?= e($ns) ?>">
<?php foreach ($paths as $path): ?>
  <url>
    <loc><?= e(abs_url($path)) ?></loc>
    <lastmod><?= iso_today() ?></lastmod>
    <changefreq><?= $path === '/' ? 'daily' : 'weekly' ?></changefreq>
    <priority><?= $path === '/' ? '1.0' : '0.8' ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
