Skip to content

[FIX] howto/website_themes: Pages - New page template creation method #14147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions content/developer/howtos/website_themes/pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ Create preset static page templates available from the New Page dialog window.
**Declaration**

The page templates has to be defined into the :file:`__manifest__.py` of the module through
`new_page_templates`:
`new_page_templates` and :file:`new_page_template_templates.xml`:

.. code-block:: python
:caption: `/website_airproof/__manifest__.py`
:emphasize-lines: 15-18
:emphasize-lines: 11,16-19

{
'name': 'Airproof Theme',
Expand All @@ -288,6 +288,7 @@ The page templates has to be defined into the :file:`__manifest__.py` of the mod
'depends': ['website'],
'data': [
# ...
'views/new_page_template_templates.xml'
],
'assets': {
# ...
Expand Down Expand Up @@ -327,20 +328,22 @@ Instantiate each building block (modified or not) for the page template:
<template id="new_page_template_s_airproof_text_block_h1" inherit_id="website_airproof.s_airproof_text_block_h1" primary="True"/>
<template id="new_page_template_airproof_faq_s_title" inherit_id="website.s_title" primary="True"/>

Then, create your page template with some `t-snippet-call` within an '#wrap' as explained above:
Then, create your page template with some `t-snippet-call` within an `#wrap` as explained above:

.. code-block:: xml
:caption: `/website_airproof/views/new_page_template_templates.xml`

<div id="wrap">
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_text_block_h1"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_title"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_faq_collapse"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_call_to_action"/>
</div>
<template id="new_page_template_sections_airproof_faq" name="Airproof - New Page Template FAQ">
<div id="wrap">
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_text_block_h1"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_title"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_faq_collapse"/>
<t t-snippet-call="website_airproof.new_page_template_airproof_faq_s_call_to_action"/>
</div>
</template>

Once the page template is created, it can be added to an existing group. Find below a list of the
existing group:
Once the page template is created, create a custom group and add it to the existing ones. Find below a list of the
existing groups:

.. code-block:: xml
:caption: `/website/views/new_page_template_templates.xml`
Expand All @@ -360,7 +363,7 @@ Feel free to add custom groups to the list:
.. code-block:: xml
:caption: `/website_airproof/views/new_page_template_templates.xml`

<template id="new_pages_template_groups" inherit_id="website.new_pages_template_groups" name="Airproof - New Page Template Groups">
<template id="new_page_template_groups" inherit_id="website.new_page_template_groups" name="Airproof - New Page Template Groups">
<xpath expr="//div[@id='custom']" position="after">
<div id="airproof">Airproof</div>
</xpath>
Expand Down