Build custom iWeb templates using iWeb as the editor
Feb 21, '06 05:05:00AM
Contributed by: phfdehaan
I wanted more (and possibly easier) customized iWeb templates than Suzanne described with her 11 Mystics method. Laying out a page in coding XML is a no-no. Using a GUI is what goes. This is about combining Suzanne's tutorial and building onto it.
After digging down in ~Library -> Application Support -> iWeb -> Domain.sites, I discovered that the saved site from iWeb contained all the XML, pictures, etc. as being used on the iWeb template itself. Only enriched with the stuff you did to it. In theory, iWeb _could_ be used to generate a template. The good news is: in practice it does, too!
Here's how it works:
- Use Suzanne's tutorial to create your own template first. Change things like navigation, fonts/sizes, etc. first if you like.
- Ensure your Domain.sites from ~Library/Application Support/iWeb/ is backed up (if you already have a site built with it).
- Delete your Domain.sites package in ~Library/Application Support/iWeb/
- Open "Your About Me .webtemplate from the iWeb package and ensure al graphics and other stuff you want to use are in there.
- With the package still open, start up iWeb.
- Choose "your template" and for example the "About Me" if you have this one open as the .webtemplate.
- Change the layout to your likings. Graphics and stuff you want in are dragged and dropped only from the .webtemplate package you have open. Forgot things? Put them in first, and then drag and drop.
- When finished, save and quit iWeb.
- Copy the Domain.sites from ~Library/Application Support/iWeb/ to a safe location.
- Open the Domain.sites package and unzip index.XML.gz. These are "the brains" of your modified template.
- Using a pure text editor such as BBEdit, open this file and ensure all tags are at one line at a time. Replacing >< with >carriage return< does the trick. The >carriage return< is between the first and second line of the XML file.
- Copy the "original" Index.XML.gz from the .webtemplate to a save location and unzip it. Open this file in BBedit too.
- Put the windows next to each other and start comparing.
You'll find differences which prevent you from opening the output Index.XML file as a template. Things have to be changed back selectively to make it usable as a template file again. The hideous task here is to spot the relevant differences and change them back.
Watch for changes in the following: kSFWPHyperlinksEnabledProperty, BLCreationLocaleProperty, BLPageGuidesEnabledProperty, BLNumberOfTimesSavedProperty is not in the template, so delete it, kSFWPGhostTextAuthoringEnabledProperty, etc. You have to scan some 50 lines in the first part to see what's changed/broken, or prevents editing.
Exact guidelines can't be given, because what's in the XML is based on the XML in the original template you based your copied one on.
With some logic and starting to read, read thoroughly, compare, delete, modify etc., you can succeed. My first guesses did work out: the template created works like a charm. Although I was a bit afraid of deleting a whole block of code that wasn't in the original Index.XML.
How to get it back in? Just gzip the Index.XML file and copy it to your .webtemplate package folder. Next time you start iWeb and select your new page from your template, everything will be preset the way you layed it out. Cool!
Now I can add pages to my site (business, under construction), without first changing things like page width, header height, adding a logo, putting lines here and there, adding some pictures, changing the text attributes, deleting stuff I don't want in there anyway, etc. The Blog template, after my operation, is much easier. A new entry comes in "corporate style," with all bells and whistles added and in the right position. Just type in a few lines, and the latest news is there. Now if only ... there were ways to ad a contact form, shell a webshop through iWeb, etc.
[robg adds: I haven't tested this one...]
Comments (6)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060216111118159