Skip to main content

Static Pages & Flatpages

Static pages are templates with a direct link configured via Omnitron and content, also managed via Omnitron. They are also called "flatpages", hence their folder in project is templates/flatpages. For consistency, this document will use the name flatpages.

Since flatpages are managed via Omnitron, they get some attributes by default to use the information from Omnitron. These attributes are title and content, which is used in templates as {{ flatpage.title }} and {{ flatpage.content }} respectively.

<section class="flatpage">
<h1>{{ flatpage.title }}</h1>
{% autoescape false %}
{{ flatpage.content }}
{% endautoescape %}
</section>

Base Layout Extend

Flatpages may or may not use the general design of the website, depending on their designs. If they do, they need to be extended from the base layout as usual.

{% extends 'layout/base.html' %}

If they have a different design, e.g. without header or footer, then you might not want to do this.

Forms

It is possible to use forms in flatpages. The most commonly used form is the "contact us" form.

This form usually co-exists in account pages. In that case, the form in /templates/account/contact can be used in your flatpage with a Jinja2 include. Have a JS file which creates an instance of AccountContact class, add it to /templates/layout/router.js if it doesn't already exist and your contact form is ready to use.

{% include 'account/contact/index.html' %}

Widgets

It is also possible to use widgets in flatpages. Please refer to widgets documentation for more information.

3rd Party Tools

Some projects might want to use 3rd party tools. In that case, an empty flatpage is created with only flatpage content.

{% autoescape false %}
{{flatpage.content}}
{% endautoescape %}

Then, one can create a new page via Omnitron, use this template file and inject the tool they want via the content area.