Templating a website is an effective way to avoid repeated content and the associated maintenance overhead. There are occasions when this common content needs to be replaced for one or two exceptional pages; for example, a homepage may require slightly different header information than other pages in a site. This problem can be solved by the homepage not utilizing a template, but this then means that any common content that the homepage does require is repeated in the homepage and the template.
In this recipe we will create a Visualforce template that provides header and footer content. A page may override the header text provided by the template. We will then create two Visualforce pages that utilize this template: A StandardHeader page (that displays the standard header text) and a CustomHeader page (that provides its own custom text for use in the header). We will then make these pages publicly available via an unauthenticated Force.com site.