<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
    <title>{{ htmlspecialchars($channelTitle) }}</title>
    <link>{{ $channelLink }}</link>
    <description>{{ htmlspecialchars($channelDescription) }}</description>
    <language>en-us</language>
    <lastBuildDate>{{ $buildDate }}</lastBuildDate>
    <atom:link href="{{ $feedUrl }}" rel="self" type="application/rss+xml" />
    <atom:link href="{{ $canonicalUrl ?? $feedUrl }}" rel="canonical" />
    @foreach ($artworks as $artwork)
    <item>
        <title><![CDATA[{{ $artwork->title }}]]></title>
        <link>{{ url('/art/' . $artwork->id . '/' . ($artwork->slug ?? '')) }}</link>
        <guid isPermaLink="true">{{ url('/art/' . $artwork->id . '/' . ($artwork->slug ?? '')) }}</guid>
        <pubDate>{{ $artwork->published_at?->toRfc2822String() }}</pubDate>
        <author><![CDATA[{{ $artwork->user?->username ?? 'Unknown' }}]]></author>
        @if ($artwork->description)
        <description><![CDATA[{{ strip_tags($artwork->description) }}]]></description>
        @endif
        @php $thumb = $artwork->thumbUrl('sm'); @endphp
        @if ($thumb)
        <media:thumbnail url="{{ $thumb }}" />
        <media:content url="{{ $thumb }}" medium="image" />
        @endif
    </item>
    @endforeach
</channel>
</rss>
