<?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">
    
    <url>
        <loc>https://gadcs-sd.net/</loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
        <image:image>
            <image:loc>https://gadcs-sd.net/images/logo.jpg</image:loc>
            <image:title>كلية القضارف للعلوم والتكنولوجيا</image:title>
        </image:image>
    </url>
    
    <url>
        <loc>https://gadcs-sd.net/#about</loc>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <url>
        <loc>https://gadcs-sd.net/#departments</loc>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <url>
        <loc>https://gadcs-sd.net/#faculty</loc>
        <changefreq>weekly</changefreq>
        <priority>0.7</priority>
    </url>
    
    <url>
        <loc>https://gadcs-sd.net/#news</loc>
        <changefreq>daily</changefreq>
        <priority>0.9</priority>
    </url>
    
    <url>
        <loc>https://gadcs-sd.net/#contact</loc>
        <changefreq>monthly</changefreq>
        <priority>0.6</priority>
    </url>
    
    <?php
    // إضافة أخبار ديناميكية إلى sitemap
    include "include/template/conn.php";
    try {
        $stmt = $con->query("SELECT news_id, news_date FROM news WHERE is_active = 1 ORDER BY news_date DESC LIMIT 50");
        $news_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
        foreach($news_items as $news) {
            echo '
    <url>
        <loc>https://gadcs-sd.net/news_details.php?id=' . $news['news_id'] . '</loc>
        <lastmod>' . date('Y-m-d', strtotime($news['news_date'])) . '</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.6</priority>
    </url>';
        }
    } catch(PDOException $e) {
        // ignore
    }
    ?>
    
</urlset>