Offering static snippets to the user
Static snippets are reusable components or blocks of HTML, CSS, and JavaScript that can be inserted into website pages using Website Builder. These snippets allow for easy customization and construction of web pages without needing to write code from scratch.
Odoo’s website editor offers several editing building blocks, which can be dragged onto the page and edited according to your needs. This recipe will cover how to offer your own building blocks. These blocks are referred to as snippets. There are several types of snippets, but in general, we can categorize them into two types: static and dynamic. A static snippet is fixed and does not change until the user changes it. Dynamic snippets depend on database records and are changed based on record values. In this recipe, we will see how to create a static snippet.
How to do it…
A snippet is actually just a QWeb view that gets injected into the Insert blocks bar. We will create...