<?php
// Force the browser and search engines to read this raw file as an XML document
header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;

$domain = "https://jessymaypotts.com";

// 1. CORE LANDING PAGES (Hardcoded main destinations)
$static_pages = [
    '/',
    '/gallery',
    '/videos',
    '/about'
];

foreach ($static_pages as $page) {
    echo "  <url>" . PHP_EOL;
    echo "    <loc>" . $domain . $page . "</loc>" . PHP_EOL;
    echo "    <lastmod>" . date('Y-m-d') . "</lastmod>" . PHP_EOL;
    echo "    <changefreq>daily</changefreq>" . PHP_EOL;
    echo "    <priority>1.0</priority>" . PHP_EOL;
    echo "  </url>" . PHP_EOL;
}

// 2. DYNAMIC CONTENT (Example: Looping through database entries or scraped profiles)
/*
include 'includes/db_connect.php'; 
$query = mysqli_query($db, "SELECT slug, updated_at FROM content_profiles WHERE active = 1");
while($row = mysqli_fetch_assoc($query)) {
    echo "  <url>" . PHP_EOL;
    echo "    <loc>" . $domain . "/profile/" . htmlspecialchars($row['slug']) . "</loc>" . PHP_EOL;
    echo "    <lastmod>" . date('Y-m-d', strtotime($row['updated_at'])) . "</lastmod>" . PHP_EOL;
    echo "    <changefreq>weekly</changefreq>" . PHP_EOL;
    echo "    <priority>0.8</priority>" . PHP_EOL;
    echo "  </url>" . PHP_EOL;
}
*/

echo '</urlset>';
?>