Skip to content

Instantly share code, notes, and snippets.

@maximevalette maximevalette/ forked from bsag/
Last active Aug 29, 2015

What would you like to do?

Instructions for setting up Octopress to ping FeedPress

FeedPress checks at regular intervals (about once an hour, 20 minutes for Premium users) to check whether your Octopress Atom or RSS feed has been updated. However, if you'd like to notify FeedPress as soon as you publish, and you have a Premium FeedPress account, you can set up Octopress to ping FeedPress when you deploy.


  1. You use Octopress
  2. You use FeedPress to manage your Octopress Atom or RSS feed and have a Premium FeedPress account

Setting up

  1. You need to make a new API app. Go to and select 'New app'. Fill in the relevant details (you can call the app whatever you like) and create it. At the top of the page you'll see your API key and token listed. Make a note of these, because we need to supply them when using the API.
  2. There are various ways to store the API credentials, but I prefer to store them as environment variables in a hidden file in my home directory called ~/.secrets. See file 'secrets' for details, replacing 'YOURKEYHERE' and 'YOURTOKENHERE' with the actual values of yours, of course. If you add the lines shown in 'zhsrc' below to your .bashrc or .zshrc then your credentials will be in your environment each time you start your shell. For now run source ~/.secrets to set it up. You can check that it worked with the commands echo $FEEDPRESS_KEY and echo $FEEDPRESS_TOKEN, and you should see your key and token printed.
  3. You need to have the gem httparty installed to add the following line to your Gemfile, inside the development group: gem 'httparty'. Then you should run bundle install inside your blog directory to install httparty.
  4. Add lines listed below in the file 'Rakefile' to your Rakefile.


When you deploy your site, instead of running rake deploy, run rake ping_deploy. This will first deploy your site by whatever method you usually use (pushing to Github Pages or using rsync) and will then ping FeedPress. If you load the URI for your feed in a browser, you should see that it is immediately updated with your new content. If you want to ping FeedPress separately from deploying, you can just run rake ping.

# Insert this code in your Rakefile after the deploy task
desc "Ping FeedPress to notify about new content"
task :ping do
require 'httparty'
# Ping FeedPress to notify of updated feed
# Add the FeedPress key and token as environmental variables in your shell
# via a ~/.secrets file that you source in .bashrc or .zshrc
# Specify urilv_name (short feed code). When you visit
# this is what is listed in the table under the heading 'Code'
urilv_name = "yourshortfeedcode" # the short feed code for your feed in FeedPress
ping = HTTParty.get( '', {:query => {:key => mykey, :token => mytoken, :feed => urilv_name}} )
if ping.code == 200
puts "==> Pinged FeedPress successfully. #{ping['message']}"
puts "Error: Ping rejected (#{ping.code} - #{ping.message})"
desc "Ping and deploy"
task :ping_deploy => [:deploy, :ping] do
# FeedPress key and token
# use ~/.secrets file to hold secret API keys etc.
# Put these lines in your .zshrc or .bashrc
if [[ -a ~/.secrets ]]
source ~/.secrets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.