It’s pretty easy to add a tool to Chris Pederick’s Web Developer extension that will spider an entire site and validate it for you. The WDG validator (which the Web Developer extension doesn’t use by default) will do this for you if you add the right options in.
To add “Validate Entire Site” as a custom tool
It’s quite straightforward really. You just need to create a new tool in the Tools options (version 0.9 and up, I think) and make sure
&spider=yes is in the URL for the WDG validator. Just follow these steps:
- Select “Options…” from under the “Options” menu in the toolbar.
- Find the “Tools” options.
- Add a new tool by using the “Add…” button.
- Enter the tool description (I use “Validate Entire Site”).
- In the URL field copy and paste this:
http://www.htmlhelp.com/cgi-bin/validate.cgi?warnings=yes&spider=yes&url=The URL of the current page in the browser window will be appended to what you enter here, so the
&url=must be at the end of this line.
- Optionally, you can also add a keyboard shortcut for this tool, so that you can validate an entire site with Control+Shift+[key].
- Hit the OK button to save your new tool.
Important! Please note the updates below. There are a few limitations with using the WDG validator for this tool.
To validate a page or an entire site with a custom XML DTD
By default, the Validator assumes that a custom DTD is HTML or SGML. If your custom DTD is XHTML or XML, then you need to include the Validator’s hidden “xml” option. When validating a URL, you can specify this option by appending “&xml=yes” to the URL of the validation results. WDG HTML Validator Tips
So, this would mean that you need to add
&xml=yes into the URL for your tool.
For validating a single page with a custom XML DTD:
For validating an entire site with a custom XML DTD:
15 February 2006
This article is proving fairly popular, so I thought I’d add a couple of useful links to this tip.
- Tidybot is a very useful little program that will check multiple (X)HTML files for errors using the well-known Tidy library. Hat-tip to Rich Pedley.
- Peter Krantz has a useful article called Validating an entire site, which guides you through using the W3C markup validator code to validate your markup on a local machine (especially useful to Mac users).
30 March 2006
It’s also worth noting that the WDG validator limits its spider to checking the first 100 pages it finds.
09 July 2006
You may find that the WDG validator only validates one page if you use this tool on a page within the site you wish to validate. Use the tool on the main domain (e.g. http://dotjay.co.uk/ rather than http://dotjay.co.uk/index/) to get the validator to spider the whole site.
24 August 2006
Someone asked about validating password-protected sites. The WDG validator does allow you to validate pages behind HTTP authentication, but you must provide the username and password in the URL. The validator cannot spider a site you are already authenticated on – you must provide access details in the URL.
The Web Developer toolbar gets around this for individual pages by either asking you for access details when trying to validate a password-protected page or allowing you to use “Validate Local HTML, saving a local copy of the page and uploading that for validation.
When adding custom tools to the Web Developer toolbar, you don’t have the means to trigger a request for access details. To validate an entire site which is password-protected, you need to ensure that the username and password is entered as part of the URL.
27 March 2007
I’ve just noticed that you can also add
&hidevalid=yes to the URL to get the validator to hide the valid results it finds for your site, making it much easier for you to find problems!