reposting rss/atom feeds with jekyll semi-automatically
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Repost lib for Jekyll blog

I needed a convenient way to repost stuff in a jekyll blog, which i posted in another blog (corporate blog etc). So i mungled together this gem, which uses Feedzirra as interface, so can handle both RSS and Atom Feeds.


add to Gemfile or install with gem install:

gem "jekyll-reposter"


create a ruby file in your blog's root folder, or a subfolder like "tools", "import" etc. Here I use a executable in my root, called repost-notes

#!/usr/bin/env ruby
require "bundler"
require "jekyll-reposter"

reposter = "",
  :tags => "[notes, external]", :pretend => true

reposter.create_if do |entry|

This will create all blog posts, if not existing yet inside my ```source/_posts/`` folder.

The create_if directive decides if a blog posts is created. So if you want to filter the passed feed, like to only show specific authors posts, then here you can add any logic. In our case, we post all new items.

To filter authors:

reporter.create_if do |entry| == "stefanw"

After finshed, you can run that script like chmod +x repost-notes && ruby repost-notes

any time in your workflow, to add all new posts. Afterwards, check formatting and add categories if necessary.


There are some options, you can pass to the Reposter:

:tags         => "[notes, external]",   #categories
:dir          => "source/_posts",
:allowed_tags => %w[h2 ul li ol h3 h4 h5 code pre quote blockquote cite hr],
:meta => {   #default markdown meta tags
  "comments" => true,
  "layout" => "post"
:pretend => false   # do not create posts, but show the generated output

Additionally, there are some replacings to make a better output, you can customize that with the attribute "reposter.replacings", default are:

reposter.replacings = {
  ""       => '"',
  ""       => '"',
  "&lt;"    => "<",
  "&gt;"    => ">",
  "</li>"   => "",
  "</ul>"   => "",
  "<ul>"    => "",
  "<pre>"   => "\n\n```ruby\n",
  "</pre>"  => "```\n",
  /\s+<li>/ => "* "

Also, for SEO reasons, a link to the original post will be added at the end of each entry with a rel=canonical.