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!
- We’re starting from a clean install of the latest release of Drupal 6 (6.16 at time of writing).
- Ensure Drupal core’s blog and blogapi modules are disabled.
- 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.
- 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.
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.
- Set up the content types you want to work with WLW. Here we’re adding a content type for our blog posts.
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.
- 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.
- Create a role for users that should be able to create and edit content with WLW. We’re naming ours “WLW user”.
- 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.
- Grant the WLW role permission to use the blog API. This lets us use Writer!
- Add users who should be able to use WLW with the page and blog post content types to the WLW user role.
- 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.
- Set the default content type for the WLW user role to WLW HTML. This ensures that Drupal will use this input format with WLW.
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!
- 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.
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!
- 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.
- 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.
- In Writer, you can now attach a file and link to it by choosing the “Attach File…” command in the Insert menu or sidebar.
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!
- Uncheck the “Promoted to front page” setting for those content types that you don’t want to show up automatically on your front page.
- 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.
- 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!
- 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.
- Open wlw_blogapi.module in your favorite text editor.
- Locate the wlw_blogapi_blogger_get_users_blogs function and the code $url = 'node';.
- Replace node with the path where your content shows up automatically when it is published. For me, this is blog.
- Add your blog or refresh your theme.
- 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
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
I haven't figured this out yet, but I'll investigate and report back if I do.
Why is there a new dependency
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
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
Does this -- or is there any chance of this -- working with CCK fields?
No. I'm pretty sure it won't
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
Will this also work with Word 2007's blog posting option?
I just tried, but couldn't
I just tried, but couldn't get Word configured with my Drupal installation. Have you tried using Writer?
Working but posting as filter
Working but posting as filter html nor full html
how to set up to add automatically in full html???
Thanks for this post. I
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
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
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
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
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!
Post new comment