> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.laposta.org/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.laposta.org/_mcp/server.

# Creating an automatic table of contents with template tags

> With the lp-toc tag, you can automatically create a table of contents in your own HTML template with links to the headings in your newsletter.

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.

> **Note**
>
> 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](/kan-ik-interne-links-plaatsen-in-mijn-nieuwsbrief-bijvoorbeeld-voor-een-inhoudsopgave).

## 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.

```html
<lp-toc>
```

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](/tags-om-tekst-te-wijzigen) to include that heading:

```html
<lp-singleline lp-label="Heading above article" lp-toc>Heading above article</lp-singleline>
```

If the singleline is inside a [repeater](/tags-om-blokken-te-herhalen), 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.

```html
<lp-singleline lp-label="Heading above article" lp-toc="1">Heading in main section</lp-singleline>
<lp-singleline lp-label="Heading above article" lp-toc="2">Heading in column</lp-singleline>
```

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 `&bull;`. You can use these attributes for `<lp-toc>` to customise the bullet and the spacing:

**`lp-bullet`**

A custom bullet. This can be text (for example `*` or `&#8227;`), or the URL of an image. Laposta imports and hosts that image.

---

**`lp-bullet-padding-left`**

Number for the padding in pixels on the left-hand side.

---

**`lp-bullet-padding-right`**

Number for the padding in pixels on the right-hand side.

---

**`lp-bullet-width`**

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:

```html
<lp-toc lp-bullet="./images/bullet.gif" lp-bullet-padding-right="10" lp-bullet-padding-left="30">
```

## Related articles

#### [Making text editable with template tags](/tags-om-tekst-te-wijzigen)

Make single lines of text and longer text blocks editable in your own HTML template.

#### [Loading an RSS feed with template tags](/tags-om-een-rss-of-atom-feed-te-importeren)

Automatically fetch articles from your website into your own HTML template, so you do…

#### [Creating a table of contents with internal links](/kan-ik-interne-links-plaatsen-in-mijn-nieuwsbrief-bijvoorbeeld-voor-een-inhoudsopgave)

Automatically place a table of contents with the Table of contents block or create your…

#### [Why is it better not to put a table in your newsletter?](/ik-heb-een-tabel-geplaatst-die-niet-goed-wordt-getoond-hoe-kan-ik-dit-oplossen)

Create a schedule or overview using a list or the Columns block, so your newsletter…