More posts about: blogging, emacs, org, wordpress // 3 Comments »
I often include large images in my blog posts since I use sketches as another way to think out loud. I’d gotten used to using the WordPress web interface to drag and drop them into the relevant section of the page. I write most text in Emacs/Org Mode/Org2Blog because of the better outlining and writing tools, and then I used
sacha/org-copy-region-as-html (which you can grab from my Emacs configuration) to copy the HTML markup and paste it into WordPress. Of course, I use Emacs for source-code heavy posts that make the most of its syntax formatting support.
Someone asked me recently about how to post and update blog posts with images through Org2blog, and if I had any recommendations for workflow. I’d dropped Windows Live Writer since it was flaking out on me and the WordPress web interface had improved a lot, but before recommending just using WordPress to add images, I was curious about whether I could improve my blogging workflow by digging into Org Mode and Org2Blog further.
It turns out (like it usually does in the Emacs world) that someone had already solved the problem, and I just didn’t have the updated version. Although the upstream version of Org2Blog didn’t yet have the thumbnail code, searching for “org2blog wordpress thumbnail” led me to cpbotha’s Github issue and pull request. Punchagan’s version had some changes that were a little bit ahead of cpbotha’s, so I dusted off my ancient org2blog repository, cloned it onto my computer, and issued the following commands:
git remote add upstream https://github.com/punchagan/org2blog git pull upstream master git remote add cpbotha https://github.com/cpbotha/org2blog.git git pull cpbotha image-thumbnail
and tested it out on a blog post I’d already drafted in Org. It took me a little while to remember that the file URLs didn’t like
~, so I specified a relative path to the image instead. But then it all worked, yay! A quick
git push later, and my Github repository was up to date again.
So now I’m back to running a Git version of
org2blog instead of the one that I had installed using the built-in packaging system. The way I make it work is that I have this near the beginning of my Emacs configuration:
;; This sets up the load path so that we can override it (package-initialize nil) ;; Override the packages with the git version of Org and other packages (add-to-list 'load-path "~/elisp/org-mode/lisp") (add-to-list 'load-path "~/elisp/org-mode/contrib/lisp") (add-to-list 'load-path "~/code/org2blog") (add-to-list 'load-path "~/Dropbox/2014/presentations/org-reveal") ;; Load the rest of the packages (package-initialize t) (setq package-enable-at-startup nil)
This allows me to mostly use the packages and to satisfy dependencies, but override some of the load paths as needed.
Hope that helps someone else!