Templates are rendered in different contexts, depending on how the HTTP request is mapped. Depending on the context, the templates are resolved based on different mechanisms and the templates can access different placeholders to output dynamic information from Confluence (pages, blog posts, spaces, etc.).
This article provides a reference about all contexts, how the templates are resolved, and a list of placeholders.
Only Velocity 1.6 code is supported
Scroll Viewport only supports Velocity 1.6 code in templates. Using Velocity 1.7 code can cause your templates to not work as expected.
Depending on the context in which the template is rendered, different placeholders are available for template.
When a request is mapped to a Confluence page or blogpost, the template is rendered in the page context.
All templates that are not rendered in another context are rendered in the page context.
The Page context renders two different templates, based the following rules:
- page.vm — Used for all pages.
- home.vm — It is optional, and - if existing - will be used to output the home page of a space.
See Page Context
Blog Overview Context
A URL that links to the root, to specific categories, or to the archive of a BlogPost-Mapping, results in the template being rendered in the blog overview context.
The Blog Overview context renders different templates, based the following rules:
- blogs.vm — the mandatory, default template, that is used if not category is selected, or as fallback, if not category-specific template is available.
- blogs-<categoryName>.vm — the category-specific template that is used to render the category page for a specific blog category.
When a URL contains a search request, the templates is rendered in the search context.
- search.vm — all search request are handled by this template is used. The search template should also handle empty search results, and invalid search queries.
See Search Context
If a request results in an error (for example if a page could not be found, a user does not have permissions and so forth), the template is rendered in the error context.
- error.vm — The default (and mandatory) error template. It is used for all situations, when no specific error template is available.
- error<statusCode>.vm — Error-code specific templates are used if if statusCode matched the 3-digit HTTP status code that indicates the reason of the error.
For example, error404.vm will be used to render the error page if a page could not be found.
See Error Context