{{- $pctx := . -}}
        {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
        {{- $pages := slice -}}
        {{- if or $.IsHome $.IsSection -}}
        {{- $pages = $pctx.RegularPagesRecursive -}}
        {{- else -}}
        {{- $pages = $pctx.Pages -}}
        {{- end -}}
        {{- $limit := .Site.Config.Services.RSS.Limit -}}
        {{- if ge $limit 1 -}}
        {{- $pages = $pages | first $limit -}}
        {{- end -}}
        {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xml:base="{{ .Site.BaseURL }}">
    <channel>
        <title>{{ .Site.Params.author }}'s Art</title>
        <link>{{ .Permalink }}</link>
        <description>Feed of the art that I make!</description>
        {{ with .Site.LanguageCode }}
        <language>{{.}}</language>
        {{end}}

        {{ with .Site.Copyright }}
        <copyright>{{.}}</copyright>
        {{end}}

        {{ if not .Date.IsZero }}
        <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
        {{ end }}

        <docs>https://www.rssboard.org/rss-specification</docs>

        {{ with resources.Get "rss-image.png" }}
        <image>
            <url>{{ .Permalink }}</url>
            <title>{{ $.Site.Params.author }}'s Art</title>
            <link>{{ $.Permalink }}</link>
            <width>100</width>
            <height>100</height>
        </image>
        {{ end }}

        {{- with .OutputFormats.Get "RSS" -}}
            {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
        {{- end -}}

        {{ range $pages }}
            {{ $isguest := (.Param "guest") }}
            {{ $exclude := (.Param "excludefeed") }}
            {{ $isnsfw := (.Param "nsfw") }}

            {{ if and (and (not $isguest) (not $exclude)) (not $isnsfw) }}
                <item>
                    {{ with .Title }}
                        <title>{{ . }}</title>
                    {{ else }}
                        <title>Untitled Artwork</title>
                    {{ end }}

                    <link>{{ .Permalink }}</link>

                    <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>

                    <guid>{{ .Permalink }}</guid>

                    {{ with .Summary }}
                    <description>{{ "<![CDATA[" | safeHTML }} {{ . | safeHTML }}]]></description>
                    {{ else }}
                    <description>This artwork has no description.</description>
                    {{ end }}

                    {{ with $.Site.Params.author }}
                        <author>{{ . }}</author>
                    {{ end }}

                    <content:encoded>{{ "<![CDATA[" | safeHTML }}
                        {{/* Partial used to display a thumbnail of an artwork. */}}

                        {{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host .Params.slug }}
                        {{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host .Params.slug }}

                        <a aria-label="Gallery Item" class="no-decoration grid-item" href="{{ .Permalink }}">

                            {{ $title := .Title }}
                            {{ $year := .Date.Format "2006" }}
                            <picture>
                                <source srcset="{{ $full }}" type="image/avif" width="{{ $.Params.thumb_width }}" height="{{ $.Params.thumb_height }}"/>
                                <img style="width: 100%; height: auto;" alt="{{ $.Params.alt_text }}" title="{{ $title }} ({{ $year }})" width="{{ $.Params.thumb_width }}" height="{{ $.Params.thumb_height }}" src="{{ $jpeg }}"/>
                            </picture>
                        </a>

                        {{ with .Content }}
                        <p>{{ . | safeHTML }}</p>
                        {{ else }}
                        <p>This artwork has no additional commentary.</p>
                        {{ end }}]]>
                    </content:encoded>
                </item>
            {{ end }}
        {{ end }}
    </channel>
</rss>
