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

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

    <url>
        <loc>https://bdcrimewatch.com/</loc>
        <priority>1.0</priority>
    </url>

    @foreach($posts as $post)

        @php
            // Generate slug from title_bn (same as homepage)
            $slug = strtolower(
                trim(
                    preg_replace(
                        '/[^A-Za-z0-9অ-৿]+/u',
                        '-',
                        $post->title_bn
                    )
                )
            );
        @endphp

        <url>
           <loc>https://bdcrimewatch.com/view-post/{{ $post->id }}/{{ rawurlencode($slug) }}</loc>
            <lastmod>
                {{ \Carbon\Carbon::parse($post->updated_at)->toAtomString() }}
            </lastmod>
            <changefreq>hourly</changefreq>
            <priority>0.8</priority>
        </url>

    @endforeach

</urlset>