A decent WYSIWYG-editor shipped with Drupal core is a much requested feature. Until that happens, there are other interesting ways around. For example, a lot of people, including myself, are using Google Docs to manage documents online. It is really easy to publish these documents to your Drupal website using blogapi module, which is part of Drupal core.

Using Google Docs to post to your website has a lot of advantages:

  • you can write your content using an easy to use rich text editor
  • you can easily share your documents for editing/reviewing with other people before publising them
  • a spell checker is automatically available in more than 30 languages
  • you can easily upload images from your computer, and insert, rescale and position them in your document: when you publish the document to your website, Google Docs automatically creates an image tag pointing to the image at the Google servers
  • when your document has been changed (or you want to roll back to a previous revision), you can update the content on your website with one simple click

The only problem with this approach is that on a lot of Drupal websites, the default input format is set to filtered HTML. Especially if comments are enabled on your site, you don't want to allow everyone to use the full HTML format. However, Google Docs obviously produces a lot more complex HTML than what is generally allowed by the filtered HTML format, and when it publishes your document to your website this will result in a really messy post. The solution to this problem is to install default filter module, which allows you to assign a different default input format to different roles. Since Google Docs authenticates using your own user account, you can set the full HTML format as the default for your role, and all will be good.

The following short tutorial shows you how you can set this up (Drupal 5.x). An example of a post published using Google Docs can be found here.

  1. Download default filter module and upload it to your server
  2. On your Drupal website, enable blogapi module and default filter module (Administer - Site Building - Modules)
  3. In Administer - Site Configuration - Blog APIs, choose the node type for which you want to enable posting via Google Docs - 'story' would be a good choice
  4. Create a new role, for example called 'blogger', in Administer - User management - Roles
  5. Edit your own account (and the account of other people that need to use this system), and add them to this new role (Administer - User management - Users)
  6. In Administer - User management - Access control, make sure that everyone who is going to blog through Google Docs is allowed to create and edit the node type that you chose in step 3
  7. Next, navigate to Administer - Site configuration - Default Filter Settings and create a new filter association for your node type and role (e.g. set 'full HTML' as the default format for the role 'blogger' and the node type 'story')
  8. If necessary, go to Administer - Content management - Content types and set the default workflow options the way you like
  9. Create a Google Docs account if you don't have one yet
  10. Login to Google Docs, and create a new document
  11. When you're done, click the 'Publish' tab and click 'change your blog settings' which is at the bottom of the page
  12. Fill out the settings form as indicated in the screenshot below. Replace yourdomain.com by the url of your website, your_username by, well, your username, node_type by the node type you chose in step 3, and type the password that you use to login to your Drupal website. Trial and error further showed me that only the MetaWeblog API works without errors, so don't select Blog API or MovableType API
  13. Once you're done, click 'Post to blog', and that's it!
  14. To update your post after changing the document, simply go back to the 'Publish' tab and click 'Republish post'
Google Docs Settings

The only glitch that I found is that I can't get tagging to work. The Google Docs manual mentions that it should be as simple as annotating the documents with some keywords (i.e. dragging the document into some folders in the left sidebar), but for some reason these tags don't appear on my website, no matter what vocabulary settings were used...