Odoo offers user-friendly and efficient website management tools, enabling users to easily create and customize websites. These tools include a drag-and-drop feature for snippets. The website editor in Odoo provides various editing building blocks that users can drag and drop onto their pages, customizing them as needed. Additionally, users can learn to create their own building blocks. Odoo categorizes snippets into two main types: static snippets, which remain fixed until modified by the user, and dynamic snippets, which are based on datasets and stored in the Odoo backend.
How to create a static snippet?
1. Create a template for the snippet.
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="basic_snippet" name="Basic Snippet">
<section class="container">
<div class="row">
<div class="col-md-12">
<h1>Basic Snippet.........</h1>
<p>This is a basic snippet that is used to test the basic functionality of the snippets.</p>
</div>
</div>
</section>
</template>
</odoo>
2. Record the snippet as static
The provided XML code extends the website.snippets template in Odoo, specifically targeting the div with id='snippet_content.' It inserts a new snippet with the title 'blog_snippet.basic_snippet' after the last existing snippet in the designated position.
<template id="external_snippets" inherit_id="website.snippets" priority="8">
<xpath expr="//div[@id='snippet_content']//t[@t-snippet][last()]" position="after">
<t t-snippet="blog_snippet.basic_snippet"/>
</xpath>
</template>