frequent frequent - 7 months ago 64
HTML Question

How to make a sitemap link in the page head pass the w3c validator?

I'm trying to pass a page through the W3C Validator. The validation fails on the sitemap, which I'm including like this:

<link rel="sitemap" type="application/xml" title="Sitemap" href="../sitemap.xml" />

The error I'm getting is:
Bad value sitemap for attribute rel on element link: Not an absolute IRI. The string sitemap is not a registered keyword or absolute URL
. I have been trying forever to fix it, but nothing I'm trying seems to work plus this is the recommended layout by Google and Html5 Boilerplate.


Is there anything wrong with my syntax. Seems correct, but why is it not passing?


The short answer is that you cannot.

HTML 5 defines the values that you are allowed to use in rel and sitemap is not one of the ones recognised by the validator.

The error message does say that you can register a new link type on a wiki, but sitemap is already there so you just have to wait for the validator developers to update the validator to reflect the new state of the wiki (assuming nobody deletes the entry).

(The basic problems here are that having the specification use a wiki page as a normative resource is nuts, that HTML 5 is still a draft, and that the HTML 5 validator is still considered experimental).