From 046e3c9906999cd43e074472461c0800f787b234 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 15 Dec 2019 14:41:07 +0100 Subject: Add RSS feed --- lib/templated.rb | 6 ++++++ scripts/build.rb | 2 ++ src/rss.xml.erb | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 src/rss.xml.erb diff --git a/lib/templated.rb b/lib/templated.rb index a7e0d63..9323903 100644 --- a/lib/templated.rb +++ b/lib/templated.rb @@ -7,6 +7,12 @@ def write_templated_file content_filename, options write_templated content, content_filename, options end +def write_erb erb_filename + content = ERB.new(File.read(src erb_filename)).result + cut_filename = erb_filename.sub /\.erb$/, '' + File.write build(cut_filename), content +end + def write_templated_erb erb_filename, options content = ERB.new(File.read(src erb_filename)).result cut_filename = erb_filename.sub /\.erb$/, '' diff --git a/scripts/build.rb b/scripts/build.rb index 9b48da4..a1c9754 100755 --- a/scripts/build.rb +++ b/scripts/build.rb @@ -59,3 +59,5 @@ compile_posts posts write_blog_files P.cd '..' + +write_erb 'rss.xml.erb' diff --git a/src/rss.xml.erb b/src/rss.xml.erb new file mode 100644 index 0000000..6f14b86 --- /dev/null +++ b/src/rss.xml.erb @@ -0,0 +1,23 @@ + + + + + +Martin's Blog +Random writings and notes from Martin's keyboard to your screen. +en-us +http://m-chrzan.xyz/rss.xml + + +<% posts.each do |post| %> + + <%= post['title'] %> + http://m-chrzan.xyz/<%= post['html_filename'] %> + <%= post['date'] %> + + ]]> + +<% end %> + + -- cgit v1.2.3