<?php
header('Content-Type: application/xml; charset=utf-8');
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$baseUrl = $protocol . '://' . $host;
$today = date('Y-m-d');

$urls = [
  ['loc' => '/', 'priority' => '1.0', 'changefreq' => 'daily'],
  ['loc' => '/about/', 'priority' => '0.8', 'changefreq' => 'weekly'],
  ['loc' => '/explore/', 'priority' => '0.9', 'changefreq' => 'daily'],
  ['loc' => '/create/', 'priority' => '0.8', 'changefreq' => 'weekly'],
  ['loc' => '/inspire/', 'priority' => '0.8', 'changefreq' => 'weekly'],
  ['loc' => '/connect/', 'priority' => '0.7', 'changefreq' => 'monthly'],
  ['loc' => '/video/', 'priority' => '0.9', 'changefreq' => 'daily'],
  ['loc' => '/trends/', 'priority' => '0.7', 'changefreq' => 'weekly'],
  ['loc' => '/community/', 'priority' => '0.7', 'changefreq' => 'daily'],
  ['loc' => '/resources/', 'priority' => '0.6', 'changefreq' => 'weekly'],
];
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<?php foreach($urls as $u): ?>
  <url>
    <loc><?php echo $baseUrl . $u['loc']; ?></loc>
    <lastmod><?php echo $today; ?></lastmod>
    <changefreq><?php echo $u['changefreq']; ?></changefreq>
    <priority><?php echo $u['priority']; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
