Creating an automatic table of contents with template tags
In a custom HTML template, you can specify which headings should be included in the table of contents. Laposta will then automatically compile the list of links to the articles as soon as you fill in the newsletter.
These tags only apply to an imported HTML template. If you are working in the drag & drop editor, use the ‘Table of contents’ block instead: see Adding internal links for a table of contents in your newsletter.
Placing the table of contents with <lp-toc>
Place the <lp-toc> tag where you want the table of contents to appear. A list of internal links to the content further down in the newsletter will be displayed there.
The list is built as a <table>, because various email clients render this better. The <td> containing the link is given the class lp-toc-link, and the <td> containing the bullet is given the class lp-toc-bullet.
Specifying headings with the lp-toc attribute
In the table of contents, you can only use the text from singleline elements. Add lp-toc to a singleline to include that heading:
If the singleline is inside a repeater, all singlelines you create within it will be added to the table of contents.
Do you want to include multiple groups of singlelines, for example the headings from the main section and from a sidebar column? Then assign a number to the attribute. The headings will appear in the order of those numbers.
When filling in the newsletter, you can still choose for each heading whether or not to include it in the table of contents.
Customising the bullet
By default, each item is preceded by the HTML code •. You can use these attributes for <lp-toc> to customise the bullet and the spacing:
A custom bullet. This can be text (for example * or ‣), or the URL of an image. Laposta imports and hosts that image.
Number for the padding in pixels on the left-hand side.
Number for the padding in pixels on the right-hand side.
If you use an image as a bullet, use this to specify the width (as a width attribute). This allows you to use a higher-resolution image.
A table of contents with a custom bullet and spacing on both sides looks like this: