Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions layouts/_default/rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- 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:atom="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} — {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>{{ if ne .Title .Site.Title }}{{ with .Title }}{{ . }} — {{ end }}{{ end }}{{ .Site.Params.description }}</description>
<generator>Hugo</generator>
<language>en-ie</language>
<copyright>{{ .Site.Params.organizerName }}</copyright>
<managingEditor>{{ .Site.Params.email }} ({{ .Site.Params.organizerName }})</managingEditor>
<webMaster>{{ .Site.Params.email }} ({{ .Site.Params.organizerName }})</webMaster>
{{- with .OutputFormats.Get "RSS" }}
<atom:link href="{{ .Permalink }}" rel="self" type="{{ .MediaType }}" />
{{- end }}
{{- if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
{{- end }}
{{- with .Site.Params.ogImage }}
<image>
<url>{{ . | absURL }}</url>
<title>{{ $.Site.Title }}</title>
<link>{{ $.Site.BaseURL }}</link>
</image>
{{- end }}
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<guid isPermaLink="true">{{ .Permalink }}</guid>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<dc:creator>{{ $.Site.Params.organizerName }}</dc:creator>
<description>{{ with .Description }}{{ . | html }}{{ end }}</description>
<content:encoded>{{ printf "<![CDATA[%s]]>" .Content | safeHTML }}</content:encoded>
</item>
{{- end }}
</channel>
</rss>
10 changes: 10 additions & 0 deletions layouts/blog/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
<div class="max-w-4xl mx-auto px-4">
<h1 class="text-4xl sm:text-5xl font-extrabold text-text-heading mb-4">{{ .Title }}</h1>
<p class="text-text-secondary text-lg max-w-2xl mx-auto">{{ .Description }}</p>
{{- with .OutputFormats.Get "RSS" }}
<div class="mt-6">
<a href="{{ .Permalink }}" class="inline-flex items-center gap-2 text-sm text-text-secondary hover:text-py-yellow transition-colors" title="Subscribe to the blog RSS feed">
<svg class="w-4 h-4 text-orange-400" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
<path d="M3.75 3a.75.75 0 0 0 0 1.5c7.042 0 12.75 5.708 12.75 12.75a.75.75 0 0 0 1.5 0C18 9.434 11.566 3 3.75 3ZM3.75 8.5a.75.75 0 0 0 0 1.5 6.75 6.75 0 0 1 6.75 6.75.75.75 0 0 0 1.5 0A8.25 8.25 0 0 0 3.75 8.5ZM3 15.25a1.25 1.25 0 1 0 2.5 0 1.25 1.25 0 0 0-2.5 0Z"/>
</svg>
RSS Feed
</a>
</div>
{{- end }}
</div>
</section>

Expand Down
11 changes: 11 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,16 @@
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicon.png">

{{/* RSS autodiscovery */}}
{{- if eq .Section "blog" }}
{{- with .OutputFormats.Get "RSS" }}
<link rel="alternate" type="{{ .MediaType.Type }}" title="{{ $.Site.Title }} Blog" href="{{ .Permalink }}">
{{- end }}
{{- else if .IsHome }}
{{- with .OutputFormats.Get "RSS" }}
<link rel="alternate" type="{{ .MediaType.Type }}" title="{{ $.Site.Title }}" href="{{ .Permalink }}">
{{- end }}
{{- end }}

{{/* Structured Data / Schema.org */}}
{{ partial "structured-data.html" . }}
Loading