redstrate.com/themes/red/layouts/art/rss.xml

110 lines
4.4 KiB
XML
Raw Normal View History

2022-12-20 19:16:53 -05:00
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
2023-03-26 13:56:47 -04:00
{{- $pages = $pctx.RegularPagesRecursive -}}
2022-12-20 19:16:53 -05:00
{{- 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>
2024-09-28 10:37:39 -04:00
<title>{{ .Site.Params.author }}'s Art</title>
2022-12-20 19:16:53 -05:00
<link>{{ .Permalink }}</link>
<description>Feed of the art that I make!</description>
2023-01-05 16:36:47 -05:00
{{ 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>
2024-09-28 10:37:39 -04:00
<title>{{ $.Site.Params.author }}'s Art</title>
2023-01-05 16:36:47 -05:00
<link>{{ $.Permalink }}</link>
<width>100</width>
<height>100</height>
</image>
{{ end }}
2022-12-20 19:16:53 -05:00
{{- with .OutputFormats.Get "RSS" -}}
2023-01-05 16:36:47 -05:00
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
2022-12-20 19:16:53 -05:00
{{- end -}}
2023-01-05 16:36:47 -05:00
2022-12-20 19:16:53 -05:00
{{ range $pages }}
2024-10-12 16:04:08 -04:00
{{ $isguest := (.Param "guest") }}
{{ $exclude := (.Param "excludefeed") }}
{{ $isnsfw := (.Param "nsfw") }}
{{ if and (and (not $isguest) (not $exclude)) (not $isnsfw) }}
2023-01-05 16:36:47 -05:00
<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 }}
2024-09-28 10:37:39 -04:00
{{ with $.Site.Params.author }}
2023-01-05 16:36:47 -05:00
<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>
2023-01-05 16:36:47 -05:00
2025-01-20 10:56:43 -05:00
{{ with .Params.program }}
<p>Created with: {{ . }}</p>
{{ end }}
2023-01-05 16:36:47 -05:00
{{ with .Content }}
<p>{{ . | safeHTML }}</p>
{{ else }}
<p>This artwork has no additional commentary.</p>
{{ end }}]]>
</content:encoded>
</item>
{{ end }}
2022-12-20 19:16:53 -05:00
{{ end }}
</channel>
</rss>