<?php
include "config.php";

header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

// Ana sayfa
echo "<url><loc>https://lcntercume.com/</loc><priority>1.0</priority></url>";

// Statik sayfalar
$pages = ["hakkimizda.php","hizmetler.php","blog.php","iletisim.php"];
foreach($pages as $p){
    echo "<url><loc>https://lcntercume.com/$p</loc><priority>0.8</priority></url>";
}

// İller
$q = $baglan->query("SELECT slug FROM iller");
while($row = $q->fetch_assoc()){
    echo "<url><loc>https://lcntercume.com/".$row["slug"]."</loc><priority>0.7</priority></url>";
}

// İlçeler
$q = $baglan->query("SELECT slug FROM ilceler");
while($row = $q->fetch_assoc()){
    echo "<url><loc>https://lcntercume.com/".$row["slug"]."</loc><priority>0.6</priority></url>";
}

// Blog yazıları
$q = $baglan->query("SELECT slug FROM blog");
while($row = $q->fetch_assoc()){
    echo "<url><loc>https://lcntercume.com/blog/".$row["slug"]."</loc><priority>0.5</priority></url>";
}

echo '</urlset>';
?>
