Attempt to validate a default Blogger template (II)

checklist
Image by RXAphotos

Read the first part of this post: Attempt to validate a default Blogger template (I).

5. This error is caused by an unescaped ampersand ('&') at the import of a dynamic CSS file (http://www.blogger.com/dyn-css/authorization.css?targetBlogID=xxx&zx=xxx). The import is not present in the source HTML, so it is added later. We'll just leave this one alone for now.

6. Many times declaring an incorrect Doctype messes up you entire validation. In this case there was a Strict Doctype declared, but the template included iframe tags (navbar). So I replaced

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">.
Remaining 68 Errors and 62 Warnings.

7. Some of these error are displayed by the "Edit post" button when you are logged in. Comment or delete the line <b:include data='post' name='postQuickEdit'/>. Others are displayed by the comments link at the bottom of the post. I describe how to fix these lower down the page.
Remaining 64 Errors and 58 Warnings.

8. These are personal and intentional errors to accentuate the fact that your posts also need to be written in valid html/xhtml. I added the alt attribute to the image and changed the closing tag to />. This needed to be done in the body of the post, not in the template.
Remaining 58 Errors and 58 Warnings.

9. Errors disappeared because of previous modifications

10. A lot of errors caused by the "Quick Edit Widget" buttons. I removed all of them by commenting them. A easy way to do this is to search for name='quickedit' inside the template and comment the entire element (<b:include name='quickedit'/>).
Remaining 39 Errors and 39 Warnings.

11. Problems caused by the fact that the archive is displayed as Hierarchy. The easiest way to fix this is to change the way the Archive is displayed. For this go to Layout - Page Elements and edit the "Blog Archive" gadget. I changed the Style parameter to Flat list.
Remaining 8 Errors and 8 Warnings.

12. Errors disappeared because of previous modifications

13. Errors caused by the unescaped ampersands in the dynamic css and the comments link. Note that there would be more errors if you have more posts on the specific page you validate (or less if you have less posts). This is the tricky part. Let's start with the comments.
Find the line that says:

<a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'>

The problem is with the expression expr:href='data:post.addCommentUrl'. This gets replaced by something like http://www.blogger.com/comment.g?blogID=xxx&postID=xxx and the problem is the unescaped ampersand. To fix this change the expression to this:
expr:href='"http://www.blogger.com/comment.g?blogID=xxx&amp;amp;postID=" + data:post.id'

where xxx is the id of your own blog. You can find out what your blog id is by viewing the current link. Note the hack that i used after blogID (&amp;amp;). This is because of Blogger's engine: every &amp; is replaced with &, but luckily the engine goes over the template only once. While this is a feature in blog posts, it's a problem in URLs. They do work, but they don't validate. This same method can be applied for "Email post" links if you have that activated. Just make sure you replace "comment.g" with "email-post.g"
Remaining 3 Errors and 3 Warnings.

14. Errors disappeared because of previous modifications

Now the only problems that remain are caused by the loading of a dynamic CSS file. From what I know this is a new "feature" and can not be removed. This first checks whether you are logged in to Blogger and according to that it creates a specific set of CSS rules. And because of the way it is added to the template, it makes it impossible to fix. Unfortunately, this also prevents my Yoboo from validating. And I was so happy when I saw that green bar a while back :(. I'll keep on looking for a solution to this. If anyone has any ideas, you're more than welcome to share.

And that's about all I can do for now (due to lack of time and mood). Note that I focused solely on the front page. It's very possible that other pages still have errors. I hope this helps you minimize the errors you encounter in your own validation experience. If you find that I missed something or you know of other ways to do things, please tell me your own methods to validate a Blogger template.

8 comments:

Themikenesedude said...

Agh... It's been like "Pi" at home today. I've been trying and trying to validate that minimalist template and honestly all I can say that I can think of is to just build your own or look for a site that gives them away that is unofficial and doesn't have spyware. This is retarded. I've been looking around all day and still no luck on having kosher formatting hygiene.

Also the "comment-link" hack didn't really do much for me either. When I got some coding together to make the bar disappear something else came up. Yeesh....

Anyway tell me if you have any luck because all this effort for myself has been a total utter waste of time for me.

Your article was cool though. Just remember what happened to Gollum in "Lord Of The Rings" if you feel you absolutely must find a way to remedy the formatting to be clean 110% xthml strict 1.0 and css-worthy.

Federico Sánchez said...

I don't understand the comments tag trick. Help me, please! Thank you.

ICLfan said...

That is amazing!!

I came down to 81 errors and 81 warning from 345 and 126 respectively!!

Simply amazing....

God Bless

Denny said...

to many blogger hack make some fault,,
but more simple template make loading work faster..
Some friend tell me that I can find how to max validate in here,, n thats what im looking for..

ur so great man.. thanks..

but I still confuse with the page navigation,, if I delete that mean ppl can use the navigation..

any trick?

Εργαζόμενος said...

thank thank you very much!
it take me about 12 hours(!) but at last my blog is validate.

Εργαζόμενος said...

Just for the records, follow the instructions of this post (Attempt to validate a default Blogger template (I)+(II) and

Remove
the line "include data='blog' name='all-head-content" (with /> and <"b" sorry but i cant post here all the line)

remove the Blogspot Navbar with the "better way"
http://theyoboo.blogspot.com/2009/10/how-to-really-remove-blogspot-navbar.html

choose for the comments the "Embedded below post"

and be carefull with widgets.

Thank you again!

CCNA Study Guide said...

OMG, almost 2 days trying to find this kind'a post..

3xx Errors, 3xx warning(s)
151 Errors, 211 warning(s)
144 Errors, 197 warning(s)
126 Errors, 161 warning(s)
90 Errors, 90 warning(s)
to be continue..

Great post.. Thanks alot..

Sahil @iBlognet said...

Reduced "448 Errors and 356 Warnings" to "190 Errors 101 warnings". Thanks for the guide...

Post a Comment