<?php
/** @var \Illuminate\Support\Collection|\App\Models\Article[] $articles */
$access = app(\App\Domain\Blog\ArticleAccess::class);
?>
<rss version="2.0">
    <channel>
        <title>{{ $settings->site_name ?? config('app.name') }}</title>
        <link>{{ url('/') }}</link>
        <description>{{ $settings->site_description ?? '' }}</description>
        <language>{{ app()->getLocale() }}</language>
@foreach($articles as $article)
@php
    $decision = $access->resolve($article, null, []);
    $body = $access->publicHtml($article, $decision);
@endphp
        <item>
            <title>{{ $article->title }}</title>
            <link>{{ url('/show-'.$article->id.'.shtml') }}</link>
            <guid isPermaLink="true">{{ url('/show-'.$article->id.'.shtml') }}</guid>
            <pubDate>{{ optional($article->published_at)->toRfc2822String() }}</pubDate>
            <description><![CDATA[{!! $body !!}]]></description>
        </item>
@endforeach
    </channel>
</rss>
