<?php
header('Content-Type: application/xml; charset=UTF-8');
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '');
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$base = $scheme . '://' . $host;
$today = date('Y-m-d');
$paths = ['/', '/jingxuan-video/', '/tianxin-community/', '/ai-toolbox/', '/emotion-space/'];
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<?php $ns = 'http://www.' . 'sitemaps' . '.org/schemas/sitemap/0.9'; ?>
<urlset xmlns="<?= htmlspecialchars($ns, ENT_XML1, 'UTF-8') ?>">
<?php foreach($paths as $path): ?>
  <url>
    <loc><?= htmlspecialchars(rtrim($base, '/') . $path, ENT_XML1, 'UTF-8') ?></loc>
    <lastmod><?= $today ?></lastmod>
    <changefreq>daily</changefreq>
    <priority><?= $path === '/' ? '1.0' : '0.8' ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
