You are here

Setting up Drupal 6 to Work Really Well with Windows Live Writer

Over the past few days I attempted to and eventually succeeded at getting Drupal 6 to work really well with Windows Live Writer (WLW). I read many blog posts and Drupal issue pages in the process, but none managed to fully explain how to do everything I wanted. This post is the result of my explorations and I hope you find it helpful!

Writer is a really powerful WYSIWYG HTML editor designed for blogging, but it can be used to publish non-blog HTML content to most content management systems that support XMLRPC, including Drupal. At the time of writing this, I’m a Program Manager on the Windows Live Writer team, but this post contains my own thoughts and not those of my employer.

Update 6/27/2010: Post updated to reflect the release of Windows Live Writer Wave 4 Beta.

Assumptions

  • You are somewhat familiar with Drupal (“intermediate” maybe?) though you may be able to squeeze by as a beginner.
  • You’re following these instructions from a clean Drupal install. You may be able to follow these steps from an existing installation, but there are lots of settings in Drupal and I can’t account for how different permutations of settings and installed modules will affect these steps.
  • You don’t want/need to use the blog module that comes with Drupal 6.
  • Your computer meets the system requirements for Writer.
  • You may not be familiar with Writer. Poor you!

Ok, ok. Let’s get started! Click on the screenshots to make them larger.

Section 1: Basic Interoperability Between Drupal 6 and Windows Live Writer

After completing this section, we’ll be able to:

  • Create and edit nodes of any content type (not using the core blogapi module).
  • Upload inline images, photo albums, YouTube video embeds, and more.
  • Do these things with multiple users.

Here we go!

  1. We’re starting from a clean install of the latest release of Drupal 6 (6.16 at time of writing).
     Screenshot of a freshly installed Drupal 6
  2. Ensure Drupal core’s blog and blogapi modules are disabled.
    Screenshot of Drupal 6's module admin page showing that the blog and blogapi modules are disabled
  3. Download and install the latest release of the Windows Live Writer BlogAPI module (wlw_blogapi). To get everything working, you’ll need to download a release from November 17, 2009 or later. This module is necessary because the core blogapi module in Drupal 6 doesn’t play nice with Writer.
    Screenshot of the Drupal.org Windows Live Writer BlogAPI module page
    Screenshot of Drupal 6's module admin page showing the installation of the wlw_blogapi module
  4. Download and install the latest release of the Filter Default module. This modules is necessary to allow us to set the default input format for the content types we care about working with WLW so as to not mess with the HTML that Writer generates.
    Screenshot of the Drupal.org Filter Default module page
    Screenshot of Drupal 6's module admin page showing the installation of the filter_default module
    Side note: the Better Formats module provides more functionality than the Filter Default module, but we’re aiming for simplicity. I’m sure it’s possible to obtain the same results with the Better Formats module, but I ran into some trouble, which I’m pretty sure had to do with using the default admin account (uid=1) from WLW, which bypasses the restrictions the module sets, defeating the purpose of using it.
  5. Set up the content types you want to work with WLW. Here we’re adding a content type for our blog posts.
    Screenshot of the Drupal 6 add content type admin page
    If you read the descriptions for the page and story content types, you’ll notice that story nodes will show up automatically on your front page, while page nodes will not. If you want to be able to edit nodes of a given content type in WLW using your site’s pretty theme, ensure that the “Promoted to front page” option is checked for that content type. We’ll go over how to get around this inconvenience later.
    Screenshot of our content types in Drupal 6
  6. Choose the content types you want to work with WLW on the WLW Blog API settings page. Here we choose the blog post and page content types. Once you’ve got things working smoothly, you can come back and tinker with the other settings.
    Screenshot of the WLW Blog API settings page
  7. Create a role for users that should be able to create and edit content with WLW. We’re naming ours “WLW user”.
    Screenshot of the Drupal 6 roles page
  8. Grant the WLW role CRUD (create, update, delete) permissions for the content types we want WLW users to be able to use WLW with. Here we grant these permissions for the page and blog post content types.
    Screenshot of the Drupal 6 permissions page's node permissions
  9. Grant the WLW role permission to use the blog API. This lets us use Writer!
    Screenshot of the Drupal 6 permissions page's wlw_blogapi permissions
  10. Add users who should be able to use WLW with the page and blog post content types to the WLW user role.
    Screenshot of the Drupal 6 users page
  11. Add an input format for WLW. Here we name it WLW HTML. Be sure to give the WLW role permission to use this input format and uncheck all the filters. This ensures that Drupal doesn’t mess with the HTML that Writer generates.
    Screenshot of the Drupal 6 add input format page
  12. Set the default content type for the WLW user role to WLW HTML. This ensures that Drupal will use this input format with WLW. Screenshot of the Filter Default module's input format default settings page

That’s it for this section! Keep reading. You can skip the optional sections depending on your needs.

Section 2: Writer Categories and Drupal Taxonomy Terms (Two-Way Sync)

After completing this (optional) section, we’ll be able to:

  • Choose existing Drupal taxonomy terms (categories in Writer) from both Drupal and Writer.
  • Add new Drupal taxonomy terms (categories in Writer) from both Drupal and Writer.

Here we go!

  1. Set up the taxonomies you want to be available for your content types in WLW. Here we add a new vocabulary “Categories” for use with blog posts. If you want the same set of terms available for pages as is available for blog posts, you can also check the box for pages. You can also set up a different vocabulary for each content type if you don’t want to mix terms across content types. Be sure to check the “Multiple select” box.
    Screenshot of the Drupal 6 taxonomy add vocabulary page

That’s it! You’ve now got two way synchronization of your Drupal taxonomy terms and your Windows Live Writer categories.

Section 3: Upload Non-Image Files From Writer to Drupal

After completing this (optional) section, we’ll be able to:

  • Upload files of any type we want (not just inline images) to Drupal with Writer and link to them.

Here we go!

  1. Set the permitted file extensions and upload size restrictions on the WLW Blog API settings page. There are separate settings for each role. Be sure you set appropriate settings for your WLW role. If you try to upload a file with an extension that doesn’t match one of those listed here in WLW, you’ll get an error. I also recommend configuring the “Files Upload Directory” setting so the files uploaded from Writer get put in their own folder rather than thrown in with the rest of your file uploads.
     Screenshot of the WLW Blog API's settings page
  2. Download and install the Attach File Plugin for Windows Live Writer. If you have Writer open, you’ll need to restart it for the plugin to become available.Screenshot of the Attach File Plugin's page on Windows Live Gallery
  3. In Writer, you can now attach a file and link to it by choosing the “Attach File…” command in the Insert menu or sidebar.
     Screenshot of the Windows Live Writer insert menu's attach file command        Screenshot of the Windows Live Writer sidebar's insert attach file link
    Update 6/27/2010: This command is in the Insert tab on the ribbon in Windows Live Writer Wave 4 Beta.

That’s it! You can now attach files and link to them in your content. Note that this does not use Drupal’s upload module.

Section 4: Theme Detection Without Promoting Content to the Front Page

After completing this (optional) section, we’ll be able to:

  • Reap the benefits of Writer’s theme detection without all our content automatically appearing on our front page.

When we set up the content types we wanted to work in WLW in the first section, we made sure that the “Promoted to front page” option was checked for each content type. This ensures that Writer’s theme detection works, but also means that your content will automatically appear on your “front page”, which is what the root of your Drupal site shows by default and is what is shown at /node. Depending on what you want, this may be undesirable. For example, you probably don’t want pages showing up above and below your blog posts.

Here we go!

  1. Uncheck the “Promoted to front page” setting for those content types that you don’t want to show up automatically on your front page.
  2. Recheck this setting immediately before “adding a blog account” or “refreshing your theme” in Writer for a “blog” with such a content type. Writer looks on your front page for a temporary node that it creates and then deletes as part of its theme detection. The theme detection fails if Writer can’t find this node because it doesn’t automatically show up on the front page.
  3. You can safely uncheck the setting again after you’ve added a blog account or refreshed your theme for that content type’s blog.

That’s it! Just temporarily enable the “Promoted to front page” setting when adding a new blog or refreshing your theme.

Section 5: Theme Detection on a Page Other Than the Front Page

After completing this (optional) section, we’ll be able to:

  • Reap the benefits of Writer’s theme detection even if we’ve obliterated our front page.

As mentioned in the previous section, we may not want our content to show up on the front page. In fact, we may not want our front page to exist at all! I’ve set up my website to display my blog posts at the path /blog using a View. I’ve disabled the “Promoted to front page” setting for all my content types so none of my content shows up at /node.

Here we go!

  1. Immediately before “adding a blog account” or “refreshing your theme” in Writer, you need to temporarily edit a line of the WLW Blog API module’s code. Locate the file wlw_blogapi.module. It is probably at \sites\all\modules\wlw_blogapi or \sites\default\modules\wlw_blogapi.
  2. Open wlw_blogapi.module in your favorite text editor.
  3. Locate the wlw_blogapi_blogger_get_users_blogs function and the code $url = 'node';.
  4. Replace node with the path where your content shows up automatically when it is published. For me, this is blog.
  5. Add your blog or refresh your theme.
  6. Return wlw_blogapi.module to how you found it because editing module files is naughty!

That’s it!

Section 6: Setting up Windows Live Writer to Create and Edit Drupal Nodes

Now that we’ve got Drupal set up properly we can get on to what you’ve been waiting for, setting up WLW to work with Drupal 6.

Please see my blog post Setting up Windows Live Writer 14 to Work Really Well with Drupal for full details on how to set up WLW 2009.

Update 6/27/2010: I've written up a new post for the latest version of Writer, Setting up Windows Live Writer Wave 4 Beta to Work Really Well with Drupal.

That’s it! You’re done!

Conclusion

I intend to update this post for Drupal 7 (assuming I can figure out a good solution) and for the next release of Windows Live Writer so check back frequently.

I hope this has been helpful. Please let me know if it was and anything I can do to make this post better. Thanks!

Comments

I've been using WLW with Drupal for a while now. It's great, but I do have one annoying issue: when I open up a post I've already put up to edit it, the categories don't show up and I have to re-enter them. Any idea why this might happen?

I haven't figured this out yet, but I'll investigate and report back if I do.

Why is there a new dependency on the blog.module? It worked before but no longer? You say in the instructions to not turn the module on but it seems to be required now.

Are you sure you're using a recent-enough version of wlw_blogapi? In Step 3, I note "To get everything working, you’ll need to download a release from November 17, 2009 or later."

Does this -- or is there any chance of this -- working with CCK fields?

No. I'm pretty sure it won't work with CCK. I might have heard from someone that the d7 blogapi contrib module (blogapi is not part of d7 core) might support d7 fields eventually, but probably not yet. I'm sure they're taking patches :)

Will this also work with Word 2007's blog posting option?

I just tried, but couldn't get Word configured with my Drupal installation. Have you tried using Writer?

Working but posting as filter html nor full html
how to set up to add automatically in full html???

Thanks for this post. I really appreciate your attempt to clear the air on WLW-Drupal integration. I had the setup working but the posts were made with filtered html rather than full html. I had earlier enabled the better formats module but had not tried to configure it up. Finally using your suggestion about using filter default module instead, i was able to setup full html as the default format and it now works.

However I was unable to get the categories/tags working. I see the tags in WLW, and able to set them, but they do not get set in the published posts(both blog and page types) on site. So I have to manually do it by going to site and editing category of the blog/page entry. This is really the only thing missing from my WLW-Drupal setup right now.

I'm afraid I don't have any tips other than try again from a fresh d6 installation to ensure that there aren't other modules or configuration changes getting in the way.

I had same problem. What seemed to make it work was to also tick tags when ticking multiple select (in section 2 point 1 of this article.

Before using my site with Writer, I had been using the Better Formats module, but I ran into some issues with it, much like you did and switched to the Filter Default module. I'm glad this worked for you too!

Can you give instructions on how to set it up with Drupal 7 and the new WLW 2011?

Absolutely, once I find the time to figure it out and document it :)

Great Tutorial and easy to follow but having problems with catagories, I can get everything set up in wlw but I cannot get the page into any catogory on Drupal very frustrating. Any tips

I'm not sure I understand the issue you're encountering. Could you rephrase the problem?

I've been using this setup for a while now and I'd like to thank you for providing this very useful information.

However, I was wondering if there is any way to get WLW to upload a new node/post to Drupal when you click "Publish" but to save it in an unpublished state. The reason I would like to do this is because as I am working on new content, I sometimes want to upload partially completed content to see how it looks on the site as a work in progress before it is complete. Unfortunately, if it is published, then my views that display new content will automatically start displaying links to this incomplete published node.

I don't want my users to see these nodes before they are 100% complete. Right now I have to hit publish in WLW and then go and manually unpublish it as quick as possible and hope that nobody saw it :)

You might be able to achieve this by changing the default Drupal settings for the content type in question to not be published by default, but I'm not sure whether this will affect posts made via the API or just those made via the browser. Alternatively, you could use the Rules module to automatically set new blog posts to be unpublished.

Is it really necessary to uncheck "Blog"? Some of the people who use my instance use the in-Drupal blog publishing, and some want to use WLW. I can't force either group.

How necessary is the filter_default stuff? Will it still work, but it will just mess with WLW's HTML?

I was able to add the account to WLW, and I saw the temporary post (but WLW didn't delete it). Now, whenever I try to publish or post a draft, I just get "Server Error 1 Occurred n/a"

I see that my image file has been uploaded to the server, but the post is nowhere to be seen.

-Chad

I don't believe my approach absolutely requires disabling the "blog" module, but if you're using my approach, you shouldn't need it and it is likely to cause confusion. If users want to add/edit blog entries from the web interface, they can do so (and with no need for the Blog module).

You don't absolutely need the Filter Default module (or the similar Better Formats module), but I found that one of them was necessary for the formatting from WLW to be correct. Please let me know if you didn't find this to be the case.

Unfortunately I don't know what to tell you about the error. Try installing a fresh copy of Drupal any follow my instructions exactly and see whether you can get Writer to post successfully. If so, then the problem may be specific to configuration you changed or modules you installed.

Hi, thanks for this guide, i almost have everything set up and it seems to work.
But i having problems with file attachements. I tried the "attach file" plugin but it demands for ftp-access.
On another system i have win7 and the newest WLW Version, and the same problem. Dont find an "attachment-ribon" like you mentioned above in wave4.

Can it worked with a drupal installed on Linux?

Yes, it shouldn't matter what OS Drupal is running on.

Add new comment