<?php
// sitemap.php for https://stack8finance.com

$pages = [
    [
        'loc' => 'https://stack8finance.com/',
        'file' => 'index.html',
        'changefreq' => 'weekly',
        'priority' => '1.0'
    ],
    [
        'loc' => 'https://stack8finance.com/about.html',
        'file' => 'about.html',
        'changefreq' => 'monthly',
        'priority' => '0.8'
    ],
    [
        'loc' => 'https://stack8finance.com/privacy-policy.html',
        'file' => 'privacy-policy.html',
        'changefreq' => 'monthly',
        'priority' => '0.8'
    ],
    [
        'loc' => 'https://stack8finance.com/contact.html',
        'file' => 'contact.html',
        'changefreq' => 'monthly',
        'priority' => '0.7'
    ]
];

header('Content-Type: application/xml; charset=utf-8');

echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($pages as $page): 
    $path = __DIR__ . '/' . $page['file'];
    if (file_exists($path)) {
        $lastmod = date('Y-m-d', filemtime($path));
    } else {
        $lastmod = date('Y-m-d');
    }
?>
  <url>
    <loc><?= htmlspecialchars($page['loc'], ENT_QUOTES | ENT_XML1) ?></loc>
    <lastmod><?= $lastmod ?></lastmod>
    <changefreq><?= $page['changefreq'] ?></changefreq>
    <priority><?= $page['priority'] ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
