Recently I revamped the
BifSniff site, and in doing so I realised that the site no longer validated on the
W3C validator and so I set about correcting that.
For the most part it went pretty smoothly, I had added meta tags and forgotten to close the meta tags - things like that.
Finally I was down to one issue -
unencoded ampersands in URLs.
Blogger has some dynamically generated links that don't encode the ampersands. I had already changed the icons for the 'email this post' icon, referring to the article aptly named
How do I change the Email-This-Post icon?.
This article allows you to hard code the link for emailing posts rather than using the Blogger tag that dynamically creates it - so it was a cinch to manually change the ampersand to a properly encoded one.
Delighted with myself I validated the home page and came up trumps. Only to realise that individual post pages were still not validating. Why? Because the dynamic 'Post a comment' links contained unencoded ampersands.
I figured there must be a similar solution available so I searched and searched. I don't know why but I failed to find the also aptly named article
'How can I change the "Post a Comment" text?' - but it was supplied to me post haste when I finally resorted to contacting Blogger support.
So, away on a hack, I manually changed the ampersand and thought to myself - 'that must be it now..' and indeed I thought it was when some individual post pages validated beautifully. Until I tried to validate a page which actually had comments on it.
Once again I ran into trouble with dynamically generated links containing unencoded ampersands. This time on the delete comments links. I thought about using the same process to hard code them, but was worried about a span class with some ominous looking numbers along the lines of 'item-control admin-1234567890 pid-1234567890'.
Turns out these numbers are a dynamically created css class in order to allow the delete comment link to appear only for admins or the relevant poster. So it's a bit trickier than the other two links I had tackled which is why there is no article on this one in existence yet.
As pointed out to me by Blogger support, you could hard code them using the same technique, ensuring that you take the code that Blogger generates from an admin comment post. So in other words, log in to your own blog, leave a comment on your own blog, view the source and find the code that should look something like this:
<span class="item-control admin-XXX pid-XXX">
<a style="border: medium none ;" href="http://www.blogger.com/delete-comment.do?
blogID=XXX&postID=XXX" title="Delete Comment">
<span class="delete-comment-icon">
</span></a></span>
Where XXX is a load of numbers... now, replace the
& in the url with
& and then copy the whole lot and put in into your template, replacing
<$BlogCommentDeleteIcon$>
This will allow the pages with comments to validate. HOWEVER -
only you as admin will now have the ability to delete comments, the icon will no longer show up for individual users on their own comments.
I have asked blogger support if ampersands could be encoded in dynamic urls and I'll post here when I hear back.
UPDATE: Blogger got back to me to say they are aware of the issue and they will 'probably make this change eventually' but that it is low priority as it doesn't impact on usability or accessibility at the moment. Which I understand, but I wonder how big a job it is to fix? For me it is the last hurdle toward having BifSniff validate fully. Seems a shame to throw out a validating solution over something so small from Blogger's perspective.