Skip to content

Commit

Permalink
Generate an Atom feed instead of an RSS feed
Browse files Browse the repository at this point in the history
I did this for changelog.xml as an experiment. Mostly because I wanted
to see what would happen if I did it.

I'm curious to see how an RSS reader handles the differences between
changes with stable ids being present. The RSS generator for RSS
wouldn't include the id attribute.
  • Loading branch information
danott committed Jan 16, 2024
1 parent 0024802 commit 953a668
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions lib/git_commit_changelog_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GitCommitChangelogTarget
TARGET_PATH = Build.target_dir + "/changelog.xml"
AUTHOR = "Dan Ott".freeze
TITLE = "Dan Ott's Website Changelog"
URL = "https://danott.website"
URL = "https://danott.website/changelog.xml"

def to_target
self
Expand All @@ -15,19 +15,20 @@ def hydrate
end

def render
RSS::Maker.make("2.0") do |maker|
maker.channel.author = AUTHOR
maker.channel.updated = commits.map(&:date).max.to_s
maker.channel.about = URL
maker.channel.title = TITLE
RSS::Maker.make("atom") do |maker|
maker.channel.id = URL
maker.channel.link = URL
maker.channel.title = TITLE
maker.channel.description = TITLE
maker.channel.author = AUTHOR
maker.channel.updated = commits.map(&:date).max.to_s

commits.each do |commit|
maker.items.new_item do |maker_item|
maker_item.description = commit.description
maker_item.id = commit.link
maker_item.link = commit.link
maker_item.title = commit.title
maker_item.summary = commit.summary
maker_item.updated = commit.updated
end
end
Expand Down Expand Up @@ -56,7 +57,7 @@ def title
subject
end

def description
def summary
options = {
auto_ids: false,
hard_wrap: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/includable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Includable
<link rel="stylesheet" href="/stylesheets/pygments-monokai.css" media="(prefers-color-scheme: dark)">
<link rel="alternate" type="application/rss+xml" href="/feed.xml" title="Dan Ott's Website RSS Feed">
<link rel="alternate" type="application/rss+xml" href="/changelog.xml" title="Dan Ott's Website Changelog">
<link rel="alternate" type="application/atom+xml" href="/changelog.xml" title="Dan Ott's Website Changelog">
<script src="/javascripts/script.js"></script>
</include-in-header>
Expand Down

0 comments on commit 953a668

Please sign in to comment.