--- title: Webgen::SourceHandler::Template --- ## Description The template handler processes the templates files. Templates, as the name already implies, normally specify the layout and the overall "picture" of a web page that is defined using a page file. These files are in [Webgen Page Format]({relocatable: ../webgen_page_format.html}) (the format which is also used for page files). The configuration option `sourcehandler.template.default_template` specifies the name of the default template which is used when no explicit template is set via the meta information `template`. webgen assumes that the default template is in the same directory as the page file. However, if it can not be found there, the parent directory is searched for it and so on. If a default template isn't found in the root directory, no template is used at all. This means that when you create a default template in the root directory, it is used as template for all page files that have no explicit template set. webgen also uses the concept of a template chain to support multiple templates for one page file. For example, assume that * the page file `index.page` has set the `template` meta information to `special.template`, * the template `special.template` has no `template` meta information set and * the page file `other.page` also has no `template` meta information set. The template chain for `index.page` would look like this default.template <-- special.template <-- index.page whereas the template chain for `other.page` would look like this default.template <-- index.page The first case also means that the `special.template` is nested in the `default.template`. This makes it possible, for example, to create a general website layout and then to create a special image gallery layout which uses the general one. To stop the template handler from further searching for a template, you explicitly need to set a null template for the page or template file: template: ~ This is useful if you want to have a different `default.template` in a sub directory which should provide a different look-and-feel for this subtree as the `default.template` in the root of the website.