Making blocks repeatable with template tags
When creating a template, you do not yet know how many items a newsletter will have. Using three nested tags, you can allow the person filling in the newsletter to add blocks themselves and switch between them:
<lp-repeater>determines which part of your HTML may be repeated.<lp-layout>provides the variants the editor can choose from.<lp-sublayout>bundles variants that are very similar to each other.
Within a repeater, you can also use the lp-pagebreak class to determine where a page break falls when the newsletter is downloaded as a PDF.
These tags only work in an imported HTML template, not in the drag & drop editor. Read more in Importing a custom template in Laposta.
Making blocks repeatable with <lp-repeater>
Place <lp-repeater> around the piece of HTML that may be repeated. In the editor, the block can then be added as many times as needed.
Options
The heading displayed in the editor on the left side of the screen above the layouts (and any sublayouts) of this repeater. If you do not provide a label, the editor shows a generic heading (‘Part 1’, ‘Part 2’, and so on). If the template only contains one repeater, no heading will appear.
Example
Offering variants with <lp-layout>
Within a repeater, you can offer different blocks for the editor to choose from, such as a block with the photo on the left and the text on the right, one with the photo on the right, and three photos side by side.
Place <lp-layout> inside <lp-repeater> around each block you want to offer as an option.
Options
The name under which you can select the block in the editor. Laposta takes a screenshot of each layout, so the user can see the design straight away.
Places this layout directly as soon as the template is loaded for the first time. Without this attribute, repeaters are empty at the start and the user has to add blocks themselves. For a header block, for example, placing it directly is more convenient.
Determines whether sublayouts share their content. See: Bundling similar variants with <lp-sublayout>.
Example
Bundling similar variants with <lp-sublayout>
If variants are very similar to each other, the list of individual layouts can quickly become long. Think of an image with text as well as that same setup with a button added, or a block in three background colours. With <lp-sublayout>, you bundle such variants under a single layout. The user then places the layout first and can switch between the sublayouts afterwards.
Options
Determines which sublayout appears as soon as the layout is added to the newsletter. Without this attribute, this is the first sublayout.
Uses the value shared or individual to determine whether the sublayouts share their content. Please note: you place this attribute on the <lp-layout> tag, not on <lp-sublayout>.
For example, if the editor switches between a sublayout with an image and text and a sublayout with an image, text, and a button, lp-sublayout-content determines what happens to the entered content:
Setting page breaks with lp-pagebreak
Every newsletter in Laposta can be downloaded as a PDF. By default, such a PDF consists of one long page, and if Laposta has enabled multi-page PDFs for you, the newsletter is divided arbitrarily across the pages without any additional settings. Especially when printing, this is not always convenient.
In an imported template, you can let the editor decide where a new page begins. To do this, place a piece of HTML with the lp-pagebreak class inside a repeater. This block is visible in the editor, but not in the sent newsletter. In the PDF, a new page starts at that point. There are no restrictions on the design of this block, because it is only visible in the editor.
Example
If you want to use multi-page PDFs, please email the helpdesk at helpdesk@laposta.nl. The helpdesk will then make sure you can download those PDFs in Laposta.