Adding DOCTYPE declarations in Dreamweaver and GoLive

by Joe Gillespie — Feb 1, 2002

Neither of these leading WYSIWYG editors currently add a DOCTYPE declaration to your pages automatically. Text editors like HomeSite and BBEdit do. Here's how you can add them with minimal fuss.

Dreamweaver has a default page that opens when you do "New". You can find it in the Dreamweaver Configuration folder inside "Templates" – it's called "Default.html".

If you paste:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

at the top of the source code, above <HTML>, and resave the file, every time you do "New" again, it will have this line at the top of the source code.

GoLive's instructions for saving a default "New" page involves making a "Stationery" item or a site template and opening that. There is another way.

Make a new page, go into the source page and paste the DOCTYPE declaration at the top above <HTML>. You might also want to add any common meta tags and links to external CSS or JavaScript files that you always use.

Select All and drag the selection to the "Snippets" pane of the Objects Palette where it will appear as a new icon. Double click on it and give it a name – say, "Default Header".

When you want to use this (or any other default items made the same way), just do "New", go to the Source Window, select all and delete to give a completely blank page. Now, find the "Default header" Snippet you put in the Objects Palette and drag it back to the blank source window and, presto, you have a new template complete with its DOCTYPE. Snippets are great!

Del.icio.us Digg Technorati Blinklist Furl reddit Design Float