/org2blog

blog from org-mode to wordpress

Primary LanguageEmacs Lisp

Org2blog Readme

Overview

org2blog/wp is a tool to publish directly from Emacs’ org-mode to WordPress blogs. org2blog/wp is one of the two packages named org2blog. The other is org2blog/atom by Tom Breton.

org2blog/wp should, ideally, work with any platform that supports xml-rpc but some of wordpress specific features may not work.

org2blog was inspired by and based on a wordpress posting client for muse-mode written by Ashish Shukla.

org2blog is licensed under GPLv3

Installation

Download org2blog from github

git clone http://github.com/punchagan/org2blog.git

Add the org2blog directory to your load path and then add

(setq load-path (cons "~/.emacs.d/org2blog/" load-path))
(require 'org2blog)

to your dot emacs.

Dependencies

  1. org2blog depends on xml-rpc available at Launchpad. Add it to your load-path before using org2blog.
  2. Make sure you have the latest org-mode installed. org2blog may not work with older versions of org.

Usage

Defining your blog setup

Note - This setup works only for org2blog version >=0.3. For lower versions of org2blog check an README from the commit e37126eec24ffdd785d2

You can (should) tell org2blog where your blogs are and optionally specify different values for some options. This is done by customising the variable org2blog/wp-blog-alist.

For example:

(setq org2blog/wp-blog-alist
      '(("wordpress"
         :url "http://username.wordpress.com/xmlrpc.php"
         :username "username"   
         :default-title "Hello World"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)
        ("my-blog"             
         :url "http://username.server.com/xmlrpc.php"
         :username "admin")))

This defines two blogs identified by the terms wordpress and my-blog.

The variables in the plist set for each blog over-ride the global values of the corresponding variables. url and username are mandatory variables. Others are optional. If you customize the variable org2blog/wp-blog-alist there is detail information about the meaning of each property.

If you use only categories, set the org2blog/wp-use-tags-as-categories variable.

(setq org2blog/wp-use-tags-as-categories t)

If you wish to be asked for confirmation before publishing a post, set the variable org2blog/wp-confirm-post.

To browse or customize other variables use the customize group function.

M-x customize-group org2blog RET

Logging In

Use M-x org2blog/wp-login. This function ask you for the name of one of the blogs you have configured in the org2blog/wp-blog-alist variable described above and will ask for your password. The counterpart of this function is M-x org2blog/wp-logout, which will log you out of the active blog.

Writing a new post

Use M-x org2blog/wp-new-entry.

  • Tags and Categories are comma or space separated values. Completion (for both) is triggered using C-c t. If a new category is used you will be prompted before adding it.
  • The excerpt for a post can be written as #+DESCRIPTION.
  • The parent for a page can be specified using #+PARENT.\ C-c t again provides completion for the page name.

Publishing

post buffer as draftC-c dM-x org2blog/wp-post-buffer
publish bufferC-c pC-u M-x org2blog/wp-post-buffer
post buffer as page draftC-c DM-x org2blog/wp-post-buffer-as-page
publish buffer as pageC-c PC-u M-x org2blog/wp-post-buffer-as-page

Post your existing org-files too

  • Add #+TITLE, #+OPTIONS, #+TAGS, #+CATEGORY, #+DESCRIPTION, #+DATE, to your file. (All of these are Optional)
  • Add a #+POSTID to edit an existing post.
  • Post buffer using the function names, as above.

Posting a subtree

  • Use M-x org2blog/wp-post-subtree.
  • Tags of the subtree will be used for tags. Other properties can be set using a property drawer.

Delete an entry or a page

  • If you are in the buffer of the entry/page, with #+POSTID present on the page, use :
    M-x org2blog/wp-delete-entry or M-x org2blog/wp-delete-page
  • If you want to delete a particular post (whose post-id is known) from any buffer, use
    C-u post-id M-x org2blog/wp-delete-entry.

Similarly, for a page.

Enabling org2blog mode (defines key-bindings)

  • use M-x org2blog/wp-mode. This defines the following the key-bindings:
    C-c ppublish buffer
    C-c dpost as draft
    C-c tcomplete tag or parent page name

Uploading Images

In-line images and linked images with file:// urls (e.g., [[file:///path.to.jpeg]] or [[file:///path.to.jpeg][this is an image link]] will be uploaded to the media library and the links will be updated. Captions and attributes as defined in org-mode will be preserved, but at present these attributes are not saved with the image to the library itself. [Information about uploaded files are added as a comment to the post itself, to prevent repeated uploads, but this isn’t as stable as I would like it.]

Miscellaneous

  1. You may want to look at the Export options and HTML export sections of the org-manual.
  2. If you wish to post to blogger from org-mode, look at -
    1. org2blog/atom, a g-client extension by Tom Breton
    2. org-googlecl by Richard Riley – uses googlecl
  3. If you have an issue/bug/feature request, use the issue tracker on git or drop a mail to punchagan+org2blog[at]gmail[dot]com.
  4. If you haven’t found a bug/issue, but have tried out and/or are using org2blog to post to your blog, post me a line on how you use it and on what blog. I’d love to hear from you!
  5. Now, that org2blog does have a bunch of users, I’d like to keep track of the blogs it’s being used on. :) Feel free to add your site to the list of sites using org2blog, on the wiki at github.
  6. The Dotclear weblog engine also works with org2blog