Skip to content

Commit

Permalink
introducing RSS feed
Browse files Browse the repository at this point in the history
  • Loading branch information
stebunovd committed Jan 1, 2025
1 parent 61c1397 commit 88f4acc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hugo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
baseURL = 'https://ivelum.com/'
languageCode = 'en-us'
title = "ivelum"
disableKinds = ['taxonomy', 'term', 'RSS']
disableKinds = ['taxonomy', 'term']

[markup.goldmark.extensions.typographer]
disable = true
Expand Down
Empty file added layouts/_default/section.xml
Empty file.
33 changes: 33 additions & 0 deletions layouts/blog/blog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- $pages := .RegularPages.ByDate.Reverse }}
{{- if not hugo.IsDevelopment }}
{{- $pages = where $pages "Params.sitemap.disable" "ne" true }}
{{- 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">
<channel>
<title>{{ .Site.Title }} — blog</title>
<link>{{ .Permalink }}</link>
<description>Experts in software development</description>
<language>{{ site.Language.LanguageCode }}</language>
{{ with .Site.Copyright }}<copyright>{{ . }}</copyright>{{ end }}
{{ if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
</item>
{{- end }}
</channel>
</rss>

0 comments on commit 88f4acc

Please sign in to comment.