<?php
header('Content-Type: application/xml; charset=UTF-8');
require_once __DIR__ . '/config.php';
$domain = SITE_DOMAIN;

$pages_images = [
    '/' => [],
    '/yongin-bathroom-construction'  => [],
    '/yongin-bathroom-remodeling'    => [],
    '/yongin-bathroom-renovation'    => [],
    '/yongin-tile-remodeling'        => [],
    '/yongin-tile-work'              => [],
];
// 각 페이지에 before/after 01~05 (10장)
foreach (array_keys($pages_images) as $pg) {
    $pairs = [];
    for ($i = 1; $i <= 5; $i++) {
        $n = str_pad($i, 2, '0', STR_PAD_LEFT);
        $pairs[] = "work-before-{$n}.webp";
        $pairs[] = "work-after-{$n}.webp";
    }
    $pages_images[$pg] = $pairs;
}

echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
<?php foreach ($pages_images as $pg => $imgs): ?>
  <url>
    <loc><?= $domain . $pg ?></loc>
    <?php foreach ($imgs as $img): ?>
    <image:image>
      <image:loc><?= $domain ?>/assets/images/<?= $img ?></image:loc>
    </image:image>
    <?php endforeach; ?>
  </url>
<?php endforeach; ?>
</urlset>
