<?php
header('Content-Type: application/xml; charset=utf-8');
$currentHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$origin = $currentHost ? $scheme . '://' . $currentHost : '';
$paths = ['/', '/brand-story/', '/recommendations/', '/cases/', '/insights/', '/guide/', '/updates/', '/contact/'];
$sitemapNamespace = 'http' . '://' . 'www' . '.sitemaps' . '.org/schemas/sitemap/0.9';
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<urlset xmlns="<?= htmlspecialchars($sitemapNamespace, ENT_XML1, 'UTF-8') ?>">
<?php foreach ($paths as $path): ?>
  <url>
    <loc><?= htmlspecialchars($origin . $path, ENT_XML1, 'UTF-8') ?></loc>
    <lastmod><?= date('Y-m-d') ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?= $path === '/' ? '1.0' : '0.8' ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
