<?php
/**
 * Rise Realty Group — Master Sitemap Index
 * Serves a sitemap index pointing to all sub-sitemaps
 * URL: yourdomain.com/sitemap.xml  (via .htaccess rewrite)
 */
header('Content-Type: application/xml; charset=utf-8');
header('X-Robots-Tag: noindex');

$SITE_URL = rtrim(defined('SITE_URL') ? SITE_URL : 'https://flapropertyfinder.com', '/');

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

$sitemaps = [
    ['url' => "$SITE_URL/sitemap-pages.xml",    'label' => 'Pages'],
    ['url' => "$SITE_URL/sitemap-blog.xml",     'label' => 'Blog editorial posts'],
    ['url' => "$SITE_URL/sitemap-listings.xml", 'label' => 'MLS listing posts'],
];

foreach ($sitemaps as $sm) {
    echo "  <sitemap>\n";
    echo "    <loc>" . htmlspecialchars($sm['url']) . "</loc>\n";
    echo "    <lastmod>" . date('Y-m-d') . "</lastmod>\n";
    echo "  </sitemap>\n";
}

echo '</sitemapindex>' . "\n";
