<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 
  <!-- Static pages -->
  <url>
    <loc>https://malawisongs.com/</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/new-releases</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/songs/trending</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/discover</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/genres</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/videos</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/playlist</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/mw/albums</loc>
    <lastmod>2026-01-02</lastmod>
  </url>

  <url>
    <loc>https://malawisongs.com/artists</loc>
    <lastmod>2026-01-02</lastmod>
  </url>
<?php 
ini_set('display_errors', 0);
error_reporting(0);  
require_once 'db.php';  

$query = $db->query("
  SELECT song_id, updated_at
  FROM songs
  WHERE status = 1
  ORDER BY updated_at DESC
");

while ($song = $query->fetch()) {
?>
  <url>
    <loc>https://malawisongs.com/song/<?php htmlspecialchars(strtolower(str_replace(' ','-',$song['song_id'])), ENT_XML1); ?></loc>
    <lastmod><?php date('Y-m-d', strtotime($song['updated_at'])); ?></lastmod>
  </url>
<?php } ?>

</urlset>

