{!! $xmlDeclaration !!}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>{{ $siteName }}</title>
        <link>{{ url('/') }}</link>
        <description>{{ $siteDescription }}</description>
        <language>zh-CN</language>
        <atom:link href="{{ route('feed.rss') }}" rel="self" type="application/rss+xml"/>
        <lastBuildDate>{{ now()->toRssString() }}</lastBuildDate>
        @foreach($posts as $post)
            <item>
                <title>{{ $post->title }}</title>
                <link>{{ route('posts.show', $post->slug ?: $post->id) }}</link>
                <guid isPermaLink="true">{{ route('posts.show', $post->slug ?: $post->id) }}</guid>
                <pubDate>{{ $post->published_at->toRssString() }}</pubDate>
                <description>{{ Str::limit(strip_tags($post->excerpt_or_fallback), 300) }}</description>
                @if($post->category)
                    <category>{{ $post->category->name }}</category>
                @endif
                @foreach($post->tags as $tag)
                    <category>{{ $tag->name }}</category>
                @endforeach
                @if($post->author)
                    <author>{{ $post->author->email }} ({{ $post->author->name }})</author>
                @endif
                <content:encoded><![CDATA[
                    {!! app(\App\Blog\Services\PostContentRenderer::class)->render($post) !!}
                ]]></content:encoded>
            </item>
        @endforeach
    </channel>
</rss>
