<?php
header('Content-Type: application/xml; charset=utf-8');
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$hostRaw = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '');
$baseUrl = $scheme . '://' . htmlspecialchars($hostRaw, ENT_XML1, 'UTF-8');
$today = date('Y-m-d');
$paths = ['/', '/brand-industry/', '/loft-space/', '/creative-video/', '/ai-workshop/', '/creator-warehouse/', '/contact-brand/', '/industrial-photo-diary/', '/loft-renovation-guide/', '/creative-darkroom/', '/metal-art-space/', '/warehouse-stories/'];
$xmlns = 'http' . '://www.' . 'sitemaps' . '.org/schemas/sitemap/0.9';
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="<?php echo $xmlns; ?>">
<?php foreach ($paths as $path): ?>
  <url>
    <loc><?php echo $baseUrl . $path; ?></loc>
    <lastmod><?php echo $today; ?></lastmod>
    <changefreq>weekly</changefreq>
    <priority><?php echo $path === '/' ? '1.0' : '0.8'; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
