Org2blog is a brilliant piece of coding and extremely easy to use, but it does have one failing - it can’t handle tables! I've found that if you want to use a table in a posting, then create it in a separate buffer, and then export it to html. From there you can get a screenshot of a region and then just upload that to your blog when you publish your post. Yes it is a long way round, but it does work, and could save you days of fretting and fumbling round trying to get a table in your post to be exported correctly!

I know that I've shown the code for 'org2blog' in my '.emacs' before, but this is the complete and working example -

(setq org-src-fontify-natively t)
(setq load-path (cons "~/.emacs.d/elpa/org2blog-20130707.323" load-path))
(setq org2blog/wp-confirm-post t)
(require 'org2blog-autoloads)
(require 'xml-rpc-autoloads)
(require 'metaweblog)
(require 'htmlize)
(setq org2blog/wp-blog-alist
'(("A taste of linux"
:url "http://www.sharons.org.uk/xmlrpc.php"
:username "sharon"
:wp-code 'org2blog/wp-use-sourcecode-shortcode'
:track-posts 'org2blog/wp-track-posts'
:keep-new-lines 'org2blog/wp-keep-new-lines nil'
:tags-as-categories nil)
("bananarama"
:url "http://bananarama.org.uk/xmlrpc.php"
:username "sharon")))
(add-hook 'org-mode-hook 'org2blog/wp-mode)

With this setup you can use it to post to two different wordpress sites, by logging on and then just giving the password when you're prompted for it, and then start a new post and away you go. :)

You can get 'org2blog' through the emacs package management, and that way you'll get the most current and up-to-date version. From talking to the coder (I cant think what else to call him, sorry!), he is no longer actively developing it and is looking for someone to take over the active development of it, and I would imagine that if you said that you were willing to do that then I think that he would welcome you with open arms! :) The other source for it is at - https://github.com/punchagan/org2blog To use it successfully you will also need to have a wordpress plugin called 'SyntaxHighlighter Evolved' working on your blog site, even if you dont intend to post any code!

These are my org-mode notes on how to use 'org2blog', and is copied from the 'org2blog' site.

Logging In

Use M-x org2blog/wp-login. This function asks 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.

Using post templates

Custom post templates can be specified by modifying variables 'org2blog/wp-buffer-template' and 'org2blog/wp-buffer-format-function'.

For example -

(setq org2blog/wp-buffer-template
 "-----------------------
#+TITLE: %s
#+DATE: %s
-----------------------\n")

(defun my-format-function (format-string)
 (format format-string
     org2blog/wp-default-title
     (format-time-string "%d-%m-%Y" (current-time)))))
(setq org2blog/wp-buffer-format-function 'my-format-function)

'org2blog/wp-new-entry' will now create buffers begining with a default title and the current date.

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 draft C-c d M-x org2blog/wp-post-buffer
  • publish buffer C-c p C-u M-x org2blog/wp-post-buffer
  • post buffer as page draft C-c D M-x org2blog/wp-post-buffer-as-page
  • publish buffer as page C-c P C-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 and also add htmlize.el (available in org-mode’s contrib/lisp) to your load-path. 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 :syntax hl parameter. You could also modify the default arguments passed to sourcecode shortcode blocks by customising 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 p publish buffer, C-c d post as draft, C-c t complete tag or parent page name

Uploading Images or Files

In-line images and linked images (or files) with file:// <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

You may want to look at the Export options and HTML export sections of the org-manual. If you wish to post to blogger from org-mode, look at - org2blog/atom, a g-client extension by Tom Breton org-googlecl by Richard Riley – uses googlecl Please go through the README and the FAQ, before writing to me. Also, looking at M-x customize-group org2blog-wp might help. 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!

NOTE: If you are using the package from ELPA/Marmalade, please try using the latest git version before filing a bug report. 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 do not 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.

BEGIN_SRC bash -n

I've found that even if you're posting 'emacs-lisp' code it wont be highlighted, use 'bash' instead which will be.

#+END_SRC

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.

align tables

Use C-c C-c

NB - this post has required major massaging to get it posted into wordpress, it just didn't like so much code!*



Comments

comments powered by Disqus