<?php
 date_default_timezone_set('Asia/Shanghai');
 header('Content-Type: application/xml; charset=UTF-8');
 $currentHost = $_SERVER['HTTP_HOST'] ?? '';
 $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
 $currentBase = $scheme . '://' . $currentHost;
 $urls = array('/', '/brand-story/', '/guide/', '/case-center/', '/industry-insight/', '/updates/');
 echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<urlset xmlns="<?php echo 'http' . '://www.sitemaps' . '.org/schemas/sitemap/0.9'; ?>">
<?php foreach ($urls as $path): ?>
  <url>
    <loc><?php echo htmlspecialchars($currentBase . $path, ENT_XML1, 'UTF-8'); ?></loc>
    <lastmod><?php echo date('Y-m-d'); ?></lastmod>
    <changefreq>weekly</changefreq>
    <priority><?php echo $path === '/' ? '1.0' : '0.7'; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
