<?php
header('Content-Type: application/xml; charset=UTF-8');

$dataFile = __DIR__ . '/data/content.json';
$lastmod  = file_exists($dataFile)
    ? date('Y-m-d', filemtime($dataFile))
    : date('Y-m-d');

$scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https' : 'http';
$host   = $_SERVER['HTTP_HOST'] ?? 'argon.md';
$base   = $scheme . '://' . $host;

echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc><?= htmlspecialchars($base) ?>/</loc>
    <lastmod><?= $lastmod ?></lastmod>
    <changefreq>monthly</changefreq>
    <priority>1.0</priority>
  </url>
</urlset>
