Skip to content

Commit

Permalink
new RSS feed for hackernoon.com
Browse files Browse the repository at this point in the history
  • Loading branch information
christianspecht committed Nov 3, 2024
1 parent 0291780 commit 601b140
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ posts = '/:year/:month/:day/:slug/'


[outputs]
home = ["HTML", "RSS", "ATOM", "RSSCODE", "RSSDEV", "RSSDIFF"]
home = ["HTML", "RSS", "ATOM", "RSSCODE", "RSSDEV", "RSSDIFF", "RSSHACK"]

[outputFormats]
[outputFormats.RSS]
Expand All @@ -46,3 +46,7 @@ posts = '/:year/:month/:day/:slug/'
mediatype = "application/rss"
baseName = "index"
path = "feed/diff"
[outputFormats.RSSHACK]
mediatype = "application/rss"
baseName = "index"
path = "feed/hackernoon"
24 changes: 24 additions & 0 deletions src/layouts/_default/index.rsshack.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- printf "<?xml version=\"1.0\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
<atom:link href="{{ "/feed/hackernoon/index.xml" | absURL }}" rel="self" type="application/rss+xml" />
<description>{{ .Site.Params.description }}</description>
<language>{{ .Site.LanguageCode }}</language>{{ if not .Date.IsZero }}
<pubDate>{{ time.Now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<lastBuildDate>{{ time.Now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ range (where (where .Site.RegularPages "Type" "posts") ".Params.externalfeeds" 1) }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<author>{{ .Site.Params.author }}</author>
<guid>{{ .Permalink | strings.TrimSuffix "/" }}</guid>{{ range .Params.tags }}
<category>{{ if eq . "web" }}web-development{{ else }}{{ if eq . ".net" }}dotnet{{ else }}{{ . }}{{ end }}{{ end }}</category>
{{- end }}
<description>{{ .Content | html }}</description>
</item>
{{ end }}
</channel>
</rss>

0 comments on commit 601b140

Please sign in to comment.