July 2010
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  
86

Categories

Archives

Managing WordPress Posts with vim

I’m a vim guy through and through. Always have been. But I’m no zealot. I say you use the tool that does the job. So for example, I’ve used xemacs on occasion, and it definitely has its strengths. But for day to day I’ve always come back to using vim. So when I setup this blog, I knew early on that if I was going to post at any sort of meaningful frequency, I would have to figure out how to do it through vim. Additionally I’ve grown accustom to mark up languages such as markdown & textile, so I knew I’d want to mix this capability in to both my blog & vim, as well.

NOTE: refer to these Wikipedia pages if you’re unfamiliar with vim, xemacs, markdown or textile.

Preliminary Step

Before we get started, make sure that your blog is configured to accept XML-RPC. This is a remote procedure call mechanism that allows external tools to submit posts to your blog. The option is underneath the site admin section of Wordpress. You can get to the option under Settings –> Writing. The option looks like this:

XML-RPC Option

XML-RPC Option

Getting Started

After googling a bit I came across a plugin for vim called Blogit. The main developers page for Blogit is here, while the primary vim.org plugin page is here. The latest version at the time of this article was 1.3. Installation couldn’t have been simpler.

Installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# get into vim's dot directory
% cd ~/.vim
 
# download Blogit
% wget http://symlink.me/attachments/download/16/blogit-1.3.tar.bz2
 
# install blogit
% tar jxvf blogit-1.3.tar.bz2
 
# ~/.vim directory should look similar to this
% tree -A 
.
└── plugin
    ├── blogit.vim
    └── mock_vim.py
 
1 directory, 2 files

Configuration

The only other thing you need to do to setup the Blogit plugin is to create the following file: ~/.vim/plugin/passwords.vim. In it you’ll need to add 3 pieces of information about your blog. A username & password along with the URL to your blog’s xmlrpc.php file. Here’s an example:

1
2
3
4
" login credentials for blog
let blogit_username='user1'
let blogit_password='password1'
let blogit_url='http://www.lamolabs.org/blog/xmlrpc.php'

Blogit’s Interface


…. Continue reading → Managing WordPress Posts with vim »»

How to hide a Worpress instance behind a different Apache server with mod_rewrite

After playing around with wordpress for a week I finally figured out how to get it working behind a reverse proxy with Apache between 2 machines. In this scenario SERVER A is connected to the internet, while SERVER B is on the local intranet only.

Step 1: Apache modifications on the internet facing box (SERVER A)
1
2
3
4
5
6
7
8
<virtualhost *:80>
  UseCanonicalName Off
 
  RewriteEngine On
  ServerName www.lamolabs.org
  RewriteRule ^/blog/(.*) http://machineB/blog/$1 [P,L]
  ProxyPassReverse /blog/ http://machineB/blog/
</virtualhost>
1
% /etc/init.d/httpd reload
Step 2: Apache modifications on the intranet box (SERVER B)

NOTE: wordpress is installed under “/var/www/html/apps/wordpress/current” on SERVER B

1
2
3
4
5
6
7
8
<virtualhost *:80>
  UseCanonicalName off
  ServerName www.lamolabs.org
  ServerAlias machineB
 
  RewriteEngine on
  RewriteRule ^/blog/(.*) /apps/wordpress/current/$1 [L]
</virtualhost>
1
% /etc/init.d/httpd reload


…. Continue reading → How to hide a Worpress instance behind a different Apache server with mod_rewrite »»