<?php
    /**
     * 사이트맵 목록 (sitemap index) : /sitemap.xml   (php-fpm xml 풀)
     *
     *  - /sitemap-news.xml    : 뉴스 사이트맵 (최근 48시간 기사 , Google 뉴스 규격) — 5분
     *  - /sitemap-section.xml : 메인 · 섹션 · 스페셜 시리즈 · TV 등 목록 페이지 — 1일
     *  - robots.txt 의 Sitemap: https://www.joynews24.com/sitemap.xml 로 알림 , 검색 콘솔 · 서치어드바이저에도 이 주소 하나만 등록
     */

    $siteUrl = rtrim(SiteHelper::__SITE_URL__, '/');
    $now     = (new DateTimeImmutable('now', new DateTimeZone('Asia/Seoul')))->format(DATE_ATOM);

    header('Content-Type: application/xml; charset=UTF-8');
    header('Cache-Control: public, max-age=300');

    echo '<?xml version="1.0" encoding="UTF-8"?>', "\n";
?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc><?=$siteUrl?>/sitemap-news.xml</loc>
        <lastmod><?=$now?></lastmod>
    </sitemap>
    <sitemap>
        <loc><?=$siteUrl?>/sitemap-section.xml</loc>
    </sitemap>
</sitemapindex>
