Blogger Bug - Internal Links Rewritten by the Composer

The best way to link to your own articles on Blogger is - or should be - with an internal link. Instead of using the full address to an article ("http://myblog.blogspot.com/2009/05/my-article.html") we should prefer an ambiguous internal link ("/2009/05/my-article.html")

Using an internal link means that if I decide to change the namespace of my blog at some point in the future the link will remain valid, since it only ever specified the subdirectory paths. This is especially important if you are using a domain name with your blogspot site, as you may in the future cease to own the domain. If you were to specify the full address in your links they will all break and become invalid if and when you let your domain lease run out.

The Bug


Entering Compose mode in Blogger's text editor resolves and rewrites all ambiguous links as children of www.blogger.com, thereby breaking them.

Example


Starting in the Compose window I click the Link button. In the URL field I enter the following ambiguous, internal link:

/2009/05/my-article.html


If I switch into the Edit Html mode my link is still properly preserved and displays the HTML code:

<a href="/2009/05/my-article.html">Visit My Article<a>


However, if I switch back into the Compose window - though I cannot see it yet - in the background my link has been resolved and specified. The HTML now reads:

<a href="http://www.blogger.com/2009/05/my-article.html">Visit My Article<a>


Not only has this negated the purpose of the ambiguous link - which is to maintain site integrity across changes in the domain name - but it has broken the link by resolving it to www.blogger.com instead of our blogspot site.

Even worse: Because the trigger here is simply entering into the Compose mode, if you merely attempt to edit or update an article containing ambiguous links, and if the editor opens into the Compose mode by default, then it will have already broken all internal links on the page just by reopening the post. If you save this reopened post you will have corrupted all your links.

Workaround


The only solution here is to never, ever use Compose mode. Switch into the Edit Html interface and get comfy. It's not much of a workaround, I know, but it's the only "solution" I've found.

I had hopes of finding a different access method that would allow linking to blogspot sites by blogID and postID. Alas I can find no record of the proper method for this and spamming the likely implementations hasn't gotten me anywhere, either.

For now, those concerned with using and maintaining ambiguous links will want to make sure the Settings>Formatting> option "Convert line breaks" is set to Yes and relegate themselves to the Edit Html interface. It's probably not a bad idea in any circumstance, as this is surely not the only bug in the Composer.

0 comments:

Post a Comment