Using Windows Live Writer to Create and Edit CMS Pages

While mojoPortal content management system has supported use of Windows Live Writer (or Microsoft Word to some extent) for posting in the Blog feature for quite a long time, as of mojoPortal CMS version 2.3.7.5 it is now possible also to create and edit CMS pages using Windows Live Writer. The article Using Windows Live Writer with Your Blog explains the steps to configure Live Writer, so read that article first.

For those who don't know, Windows Live Writer is free desktop software from Microsoft, designed for use with blogs, and many users prefer it or find it more user friendly than the javascript WYSIWYG editors used in mojoPortal to edit content in the web page.

Windows Live Writer provides support for a number of popular blogging APIs, in mojoPortal we have implemented the Metaweblog API which only has methods for blog posts, but we also support a few extra methods from the Wordpress API, and these are the ones that allow creating and editing pages. We are able to tell Windows Live Writer about these extra methods by including a Windows Live Writer manifest file that indicates the additional things that are supported. Basically, we are supporting the methods:

  • wp.getPages
  • wp.getPageList
  • wp.getPage
  • wp.editPage
  • wp.newPage
  • wp.deletePage

from the WordPress API.

What is a Page?

A "Page" in mojoPortal is not the same thing as a "Page" in WordPress. Whereas in WordPress a page is inseparable from its content, in mojoPortal a page is just a container for feature instances that contain the content. A page defines the url and the location in the menu but the content is not directly part of the page, it is really part of the feature instance. Of course the most commonly used feature is the Html Content feature, but in mojoPortal a page can contain more than one feature instance, and each of those instances has its own id and its own content and the id is used to edit the content of that instance. Since the API methods are defined by WordPress there is not a way to keep track of the ids for different instances of content on the page, we only have the page id to work with. So it is not possible to edit individual feature instances on a page using this API. Therefore we had to decide on a strategy to handle this difference in the way content is structured in mojoPortal in order to make it possible to create and edit pages in Windows Live Writer using the WordPress methods.

So for the purposes of using this API and using Windows Live Writer what we decided was that we would define a "Page" as a CMS page that has an instance of the Html Content feature in the middle pane. If it has more than one instance in the middle pane, we only consider the first one as part of the "Page" for this purpose. So while this is not a perfect solution it is still a pretty useful solution because it is very common to have pages with a single instance of Html Content feature in the center pane.

The list of pages available for editing will be filtered according to allowed Edit Roles on the page, so that user will only see pages that they have permission to edit. However, when creating a new page or editing an existing page, the parent page dropdown list is populated with all the pages for which the user has "View Permissions". This is needed because a user may have edit permissions on a page but not on its parent page, but he still needs to be able to keep the correct parent page selected. Also while the pages available for editing is filtered to only show pages that have an instance of the Html Content Feature in the center pane, the parent page may not, so we don't filter the parent page dropdown list based on the content on the parent page.

Permissions are enforced when editing such that users cannot create root level pages unless they are in a role allowed to create them, and they can only change the parent page to a page where they have "Create Child Page Permission". An error dialog will be shown in Windows Live Writer if the user does try to assign a parent that they are not allowed to use.

Once Windows Live Writer is configured, mousing over the File > New Post menu item will show 2 options one for blog posts and one for pages.

new post

To see the list of pages available for editing you click File > Open Recent Post, then click the name of the blog and you will see there is a radio button to choose between blog posts and pages.

recent posts and pages

To open a post or page select it and click ok. To delete one select it and click delete.

Disabling Metaweblog API or Page Editing

If you don't want users using Windows Live Writer, it is possible to disable the API completely for an installation, and it is also possible to just disable page editing while still allowing blog posts. The following settings can be added to user.config and adjusted to disable what you want.

<add key="DisableMetaWeblogApi" value="false"/>
<add key="DisableEditingPagesInMetaWeblogApi" value="false"/>
<add key="DisableDeletingPagesInMetaWeblogApi" value="false"/>

Try to Convince Your Users to Avoid Styling things in Windows Live Writer

One problem is that users may decide to format the style of the content such as fonts and colors using the tools in Windows Live Writer. The problem with that is that the result is hard coded styles embedded inline directly in the content and this is contrary to the notion of having a skin-able site. It is far better if ALL of the styles come from external CSS so that the design can be changed with one click simply by changing the skin. But those hard coded inline styles will still be there no matter what skin you use, so the result is that the content is not really skin-able and the colors and fonts the user chose may not look good in the new design you make next year. For this reason we've removed the toolbar items by default in the included WYSIWYG editors but we have no way of disabling that in Windows Live Writer, so the only solution is to educate your users to resist the temptation to style things in Windows Live Writer.

See also:

Created 2011-11-29 by Joe Audette
Updated 2012-02-27 by Joe Audette