Skip to content

Commit

Permalink
✨ Feat: update rss template
Browse files Browse the repository at this point in the history
  • Loading branch information
bambooom committed Feb 12, 2024
1 parent 387d17b commit 3cbda6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ taxonomies:

# not using tags

services:
rss:
limit: 20

params:
env: production # to enable google analytics, opengraph, twitter-cards and schema.
title: "Blah Blah Booooom"
description: "Personal Blog of Bamboo/Zhuzi/竹子"
keywords: [Blog]
# author: Me
author:
name: bambooom
email: zhuzi.mn#gmail.com
# author: ["Me", "You"] # multiple authors
images: ["<link or path of image for opengraph, twitter-cards>"]
DateFormat: "January 2, 2006"
Expand All @@ -46,12 +52,14 @@ params:
ShowCodeCopyButtons: false
ShowWordCount: false
ShowRssButtonInSectionTermList: true
ShowFullTextinRSS: true
UseHugoToc: true
disableSpecial1stPost: false
disableScrollToTop: false
comments: true
hidemeta: false
hideSummary: true
hideAuthor: true
showtoc: false
tocopen: false

Expand Down
8 changes: 4 additions & 4 deletions themes/PaperMod/layouts/_default/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description>
<description>{{ or .Description site.Params.Description }}</description>
{{- with site.Params.images }}
<image>
<title>{{ site.Title }}</title>
Expand All @@ -65,7 +65,7 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $pages }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) (ne .Layout `about`) }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
Expand All @@ -74,7 +74,7 @@
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
<content>{{ printf "<![CDATA[%s]]>" .Content }}</content>
{{- end }}
</item>
{{- end }}
Expand Down

0 comments on commit 3cbda6e

Please sign in to comment.