Skip to content

senior/org2blog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 or Marmalade

git clone http://github.com/punchagan/org2blog.git
http://marmalade-repo.org/packages/org2blog

Add the org2blog directory to your load path and then add

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

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. It may work with versions > 7, but it is best to have the latest org-mode if you can.

Usage

Defining your blog setup

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

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.

You can also use .netrc file to save your usernames and passwords.

Your .netrc should look like this

machine myblog login myusername password myrealpassword

Then, use these details, as shown below.

(setq blog (netrc-machine (netrc-parse "~/.netrc") "myblog" t))
(setq org2blog/wp-blog-alist
      '(("my-blog"
         :url "http://username.server.com/xmlrpc.php"
         :username (netrc-get blog "login")
         :password (netrc-get blog "password"))))

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

M-x customize-group org2blog/wp 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 Permalink of a post can be set using #+PERMALINK.
  • The parent for a page can be specified using #+PARENT. C-c t again provides completion for the page name.

Updating an existing post

To update a blog post, you can simply edit the content of the org file and republish using org2blog. The POSTID saved in the file, ensures that the same blog post is updated, and a new post is not made.

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. The properties use the same names as the buffer variables.
  • POST_DATE sets the date to be used for the post. If it is not present, SCHEDULED, DEADLINE or any other active or inactive time-stamps are used.
  • The headline is used as the title of the post. But, TITLE can be used to use a different title.

Posting source code blocks

Babel source blocks or example code is automatically posted in <pre> tags. You can ask org2blog to use Wordpress’s sourcecode shortcode blocks. To use this, you need to set the variable org2blog/wp-use-sourcecode-shortcode. Wordpress’s sourcecode shortcode blocks can be given various configuration parameters. These can be passed to the exported sourcecode shortcode blocks, by passing them to the babel blocks using :syntaxhl parameter. You could also modify the default arguments passed to sourcecode shortcode blocks by customizing the org2blog/wp-sourcecode-default-params variable.

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 or Files

In-line images and linked images (or files) with file:// urls will be uploaded to the media library and the links will be updated. Information about uploaded files is added as a comment to the post itself.

Captions and attributes as defined in org-mode will be preserved, but these attributes are not saved with the image to the library itself.

“Dashboard” of all posts

org2blog makes it easy to manage your blog-posts by actually keeping track of all the posts you make from it, in a simple org-table. By default it is saved in a file .org2blog.org in the org-directory. This is meant to be a dashboard of sorts, and is an optional feature that can be turned off.

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. Please go through the README and the FAQ, before writing to me. Also, looking at M-x customize-group org2blog-wp might help.
  4. 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. I’d also appreciate patches/suggestions to improve the documentation. Feel free to drop in with general comments, too. I’d love to hear from you!
  5. Feel free to add your site to the list of sites using org2blog, on the wiki at github.

FAQ

  • How many blogs can I configure with org2blog?

    You can configure and use any number of blogs with org2blog/wp. Use the org2blog/wp-blog-alist variable to configure each blog. Look at the Defining your blog setup section, in the README. But, note that you can be logged in, to just one blog at a time.

  • How do I change the default title of a new post?
    (setq org2blog/wp-default-title "My New Title")
        
  • How do I change the default title for one blog alone?

    Set the relevant (:default-title) variable in the org2blog/wp-blog-alist variable.

  • I donot use tags. I wish to use them as categories. How?

    Setting the org2blog/wp-use-tags-as-categories variable will do that for all the blogs.

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

    Instead, you can set the corresponding variable for each blog that you are using.

  • Can I configure org2blog to confirm before publishing a post?
    (setq org2blog/wp-confirm-post t)
        
  • I wish to customize the default template of a new post. How do I do it?

    Customize the variable org2blog/wp-buffer-template.

  • New-lines are not handled properly. Why?

    The behaviour of new-lines has been working since a little before version 0.3. It is highly recommended that you use the latest git version of org2blog.

    By default, new lines are stripped off from the org buffer. To retain new-lines, unset the org2blog/wp-keep-new-lines variable.

  • Why aren’t my SRC blocks not enclosed in [sourcecode] [/sourcecode] block?

    Set the org2blog/wp-use-sourcecode-shortcode variable to turn on this behaviour. You may also set it at a per-blog level, if you choose.

  • Is wordpress the only CMS/Blog-engine that org2blog/wp supports?

    Any blog engine using the metaweblog API should work, theoretically. But, it is not tested with other blog engines.

    One happy user reports that org2blog also works with the Dotclear weblog engine.

  • Is there a way to import from wordpress or other blogs into the org2blog post format?

    I’ve a simple python script that uses pandoc to convert from Wordpress export xml to org2blog posts. It could easily be tweaked to write importers for other kinds of blogs.

  • How do I split a post into an introductory paragraph and a full view.

    Just put in

    #+HTML: <!--more-->
        

    at the location where you wish to split the post.

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%