Lets you perform post deploy actions.

To install, run nikola plugin -i deploy_hooks

This is a signal handling plugin that lets you run custom commands or functions on new entries created since the last deployment.

Your command can be a template that can be rendered by the templating engine that your theme uses or a simple Python callable. The new entry/post is passed in the context to the templating engine, along with the command. If the command is a callable, the entry is passed as an argument.

Suggested Configuration:

# List of commands that need to be run for each new entry created since the
# last deployment of the site.  The commands can either be a "shell" command or
# a python callable.
# For example, you could post a new tweet each time you make a new post, using
# either a shell command or a python function!

from __future__ import print_function
def tweet(entry):
    from twitter import Twitter, OAuth, read_token_file
    from twitter.cmdline import CONSUMER_KEY, CONSUMER_SECRET, OPTIONS
    oauth_filename = OPTIONS['oauth_filename']
    oauth_token, oauth_token_secret = read_token_file(oauth_filename)

    t = Twitter(
            oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET
    tags = ' '.join(['#' + tag for tag in entry.tags])
    url = entry.permalink(absolute=True)
    status = 'New Post: %s %s %s' % (entry.title(), url, tags)

    "twitter set \"New Post: ${entry.title()} ${entry.permalink(absolute=True)} ${' '.join(['#'+tag for tag in entry.tags])}\"",

# Similar to the DEPLOYED_HOOKS variable, but the commands are run for each
# new entry that has not been deployed either because it is a draft or a future
# post.
# For example, this can be used to setup a cron/at job to deploy the site,
# after the time at which the post is scheduled.

# Set this to false, if you want the hooks to run on deployment after a clean.
# If you set this to false, the hooks will essentially run on all the posts in
# the site.

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.