This is my first attempt at submitting a Drupal patch.
I've been working (informally) with the engineers developing Windows Live Writer (WLW). The simplest mode of operation (for a WLW user), is to point to the blog's home page and let Real Simple Discovery (RSD) take care of the hard work.
The RSD spec hardly merits the term "spec", but it's all we have. It suggests placing a link to the location of the RSD file in the head section of the home page. However, RSD was designed for blogs, not CMS systems. In Drupal, the site's home page and the blog's "home" page may not be the same.
I realize that talking about a blog's "home" page involves using loose terminology--for Drupal, we can define it as the page labeled 'blog/' + the UID of the blog owner.
In the current system, the site's home page is the only page that contains the RSD link (i.e. it follows a strict interpretation of the RSD spec). But if a 'page' is promoted to the front, then the site's home page is no longer the a blog home page. This confuses WLW and reduces its usability.
My proposal is that placing the link to the RSD file in every blog home page best follows the intent of the RSD spec. It improves interoperability with WLW, which assumes it is talking to a blog and uses the URL you enter (in response to "Weblog home page URL") as both the source of the RSD link and the page on which postings will appear. I suspect it will also work well with other blogging tools.
I patched version 1.107 of blogapi.module. The patch was tested in a v5.1 Drupal system. The test for whether a page is a blog home page could probably be made more efficient by a more experienced Drupal coder. Here's the patch (also added as an attachment):
--- blogapi-1.107.module Wed Jul 25 15:38:04 2007
+++ blogapi-new.module Wed Jul 25 15:39:51 2007
@@ -571,7 +571,7 @@
}
function blogapi_init() {
- if (drupal_is_front_page()) {
+ if (preg_match('|blog/([0-9]+)?$|', drupal_get_normal_path($_GET['q']))) {
drupal_add_link(array('rel' => 'EditURI',
'type' => 'application/rsd+xml',
'title' => t('RSD'),
If you're worried about breaking existing applications with this change, you can also put the RSD link on the home page. Having extra RSD links should not harm anything.
The reason I omitted the RSD link for the home page is that WLW uses RSD if it finds it. If it doesn't the user tells WLW where the xmlrpc.php is located. The RSD system allows for only one blog per user. If WLW finds the RSD file, that's all you will get. Drupal is capable of creating pseudo-blogs for 'page', 'story', 'poll' and other content types. IF you want to use these, you need to point the WLW "Weblog home page URL" to a location without an RSD file or you will never get access to anything except your default blog.
I realize Drupal's mission is not to make WLW work, but I believe the change I suggest will also improve interoperability with other tools that use the blogging API.
| Comment | File | Size | Author |
|---|---|---|---|
| blogapi_6.patch | 425 bytes | freixas |
Comments
Comment #1
freixas commentedAfter some thinking, I would change the patch to allow for putting the RSD link on the site home page as well. I would also make the change in Drupal 6. This gives tools like w.bloggar and Windows Live Writer a chance to ask the user if they are using Drupal 5 or Drupal 6 and use the appropriate workarounds.
Comment #2
tr commentedDrupal 5.x is no longer supported, and the blogapi module was moved out of core for Drupal 7 (see #537434: Drop the blog API from core). So the only place left for this issue is in the Drupal 6.x queue.
The code changed by the patch still exists in the Drupal 6.x blogapi module, so I'm setting this to "needs review".