A script to post to tumblr wordpress octopress jekyll hexo in one go

A python script to post markdown file to your wordpress/tumblr/octopress/jekyll/hexo blog in one go

I wrote a script to deploy a post in markdown format to multi blog platforms in one go. As a blogger, probably you do not have several blog places, but if you have, say you are tech editor and need to post same post to several places, this script might help you.

Script info:

source

ReadMe

Set up

  • wordpress
    fill this section if you want to post on wordpress blog


wp_url = "http://yourdomain.com/xmlrpc.php"
wp_username = "username"
wp_password = "password"

leave it empty if do not want to set up wordpress blog


wp_url=""

you need to install markdown2 to post to wordpress, since the format of the post is in html and we need markdown2 to convert markdown data to html data


git clone [email protected]:trentm/python-markdown2.git
cd python-markdown2
sudo python setup.py install

  • tumblr

It needs some extra steps to set up tumblr settings in the script.
You need to register application first, after you obtain consumer key and consumer secret go to this address to authoize the app to access your blog, then you obtain oauth token and oauth secret , file this 4 parameters accordinglly


client = pytumblr.TumblrRestClient(
'consumer_key',
'consumer_secret',
'oauth_token',
'oauth_secret',
)

Leave this variable empty if do not want to set up tumblr


TUMBLR=""

You need to install pytumblr to post to tumblr


git clone [email protected]:tumblr/pytumblr.git
cd pytumblr
sudo python setup.py install

  • octopress

You need to have local enviroment for your octopress blog, then set path of octopress environment


OCTOPRESS="/Users/username/octopress";
POSTOCTOPRESS=OCTOPRESS + "/source/_posts";

Leave this variable empty if do not want to set up tumblr


OCTOPRESS=""

  • jekyll

You need to have local enviroment for your jekyll blog, then set path of jekyll environment


JEKYLL="/Users/airbob/jekyll";
POSTJEKYLL=JEKYLL + "/_posts";

Leave this variable empty if do not want to set up tumblr


JEKYLL=""

  • hexo

You need to have local enviroment for your hexo blog, then set path of hexo environment


HEXO="/Users/airbob/hexo";
POSTHEXO=HEXO + "/source/_posts";

Leave this variable empty if do not want to set up tumblr


HEXO=""

Let's post

so now after all set up done, let's post!
create a markdown file and write the content you intend to post, then execute as this:


vim post_name.md


./post2blog.py post_name.md

voila, after script execution finished, the same post deployed to your wordpress,tumblr,octopress,jekyll,hexo blog now.

Have fun!


For instance, I post this same post with post2blog.py
wordpress blog
tumblr blog
octopress blog
jekyll blog
hexo blog

你可能感兴趣的:(A script to post to tumblr wordpress octopress jekyll hexo in one go)