On Your Site
We recommend you follow these guidelines to ensure your templates directory structure remains manageable. More advanced users are welcome to come up with their own structure but our recommended structure is a very good starting point.
The basic templates are in the root of the template directory e.g. template). These templates should use an appropriate language for the default language for the site.
We should have the following basic templates for all sites.
a block to allow setting the page title in the head element.
a block to allow over-riding the CSS for a page.
a block to allow setting the whole of the body element.
the template for a page to be displayed when the route is not found.
this template should extend base.html. It's purpose it to allow setting standard page elements, such as header and footer to be reused by other templates. It should expose the following twig block: page_content
Sites can add other templates that define alternative page layouts to
standard_layout.html in the root directory. For example, if a site had multiple
page about an emergency appeal, having an
defines the basic look and feel of all of the emergency appeal pages would be
Dijon expects to find templates in the following directories:
Dijon looks here for page templates.
Dijon looks here for component of pages templates.
The fragment directory is used to hold templates that are by PHP functions to render elements on a page. It is appropriate for these fragments to have extra variables specific to them.
There is a common templates directory in the Dijon core. This allows us to create templates once for use with shared widgets, as the templates in that directory are available to all sites.
Just to note, it is fine to create subdirectories under the component, fragment and page directories, if that helps organise those templates.
Although we recommend using Dijon's content management features to manage different languages, you can also specify templates based on language. This can be useful, for example, when content does not fit due to different sized words.
For each language supported by the site, other than the default language, there
can be a corresponding language directory under the template directory, e.g.
template/fr. Dijon will prefer to use language specific templates when
appropriate (i.e. when the user has a language preference).
You can add a language specific versions of the page directory
template/fr/page (where fr is the language) which will be used in preference
to the default page templates when appropriate.
Page components are stored in the directory
template/component. Language specific
versions should go in
template/fr/component. Dijon will use the language
specific template when displaying content for that language when it is defined.
The fragment directory
template/fragment can also be localised to language.
Language specific fragements should go in
template/fr/fragment where fr is
the language code.
Dijon decides which template to use by looking for the most specifically appropriate template, and then working back to the more generic templates.
For example if had a user with their language set to be French, and Dijon needed
to render the donations activity feed, which is rendered through a template named
component/activityFeedDonationInfo.html. Dijon would look for these files in order: