respinar / contao-tableofcontents
Table of Contents for Contao
Package info
github.com/respinar/contao-tableofcontents
Type:contao-bundle
pkg:composer/respinar/contao-tableofcontents
Requires
- php: ^8.3
- contao/core-bundle: ^5.7
Requires (Dev)
- contao/easy-coding-standard: ^6.14
- contao/manager-plugin: ^2.0
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
This Contao extension adds a table of contents to your page using JavaScript. It scans a container (for example an article with the CSS class layout_full) for h2 and h3 headings and builds a linked list of them.
Based on https://techindetail.com/table-of-contents-javascript/
Table of contents
Table of contents (TOC) is the list of all the headings in a blog post or an article with a link to each of these headings.
TOC is used to navigate faster to a particular heading in a long content webpage: clicking a link in the TOC scrolls directly to that section of the page.
How to use
Add the Table of Contents content element or frontend module to your page and configure its settings:
| Setting | Description |
|---|---|
| Title | An optional heading shown above the table of contents. |
| Article selector | The CSS id or class of the container to scan for headings. If a matching id exists, it takes priority. Leave empty to use #main. |
| Headings | Which headings to include in the list: h2 only, or h2 and h3. |