TableOfContentsX Icon

TableOfContentsX

This extra creates a table of contents based on header tags.

By Qodo (qodo)

TableOfContentsX first screenshot

TableOfContentsX v1.2

This extra takes your MODX content and creates an ordered list table of contents based on the h1,h2,h3,h4,h5 and h6 tags. This can be used so that long articles and pages can be broken down and makes it easier for the user to click a section they'd like to jump to.

Snippet TableOfContentsX

This is the main/only snippet included in this package and takes a template variable/chunk/placeholder and generates the Table Of Contents. The snippet has one parameter and that is to select what it should output:-

  • toc - This will output an ordered list with links to your page header tags
  • content - This will output your page content with your header tags with anchors
  • A typical way of using this would be to do the following: -

    Credits

    Based on code by Joost de Valk, submitted on 02/08/2011 http://www.westhost.com/contest/php/function/create-table-of-contents/124

    For information and support, check out my blog: https://www.qodo.co.uk/blog/tableofcontentsx-a-new-modx-extra-for-creating-a-table-of-contents/

    Created by Stewart Orr @ Qodo Ltd (https://www.qodo.co.uk)

    Qodo


    New in TableOfContentsX 1.2.0

    Changelog for TableOfContentsX package.

    TableOfContentsX 1.2 - 12/07/2019

    - Fixing an issue special characters in a heading breaking the page anchors.

    TableOfContentsX 1.1 - 13/12/2017

    - Fixing an issue with installing on 2.6.0.

    TableOfContentsX 1.0.1 - 28/08/2013

    - Missed off the url relative to the document, links wouldnt work with sites with base tag

    TableOfContentsX 1.0 - 23/08/2013

    - First version - I hope you find it useful!

    More

    Information

    Released
    July 23, 2019
    Supported Versions
    2 – Current
    Downloads
    1,376
    License
    GPLv2

    More from Qodo

    SmushIt

    This snippet tries to optimise and compress PNG and JPEG images for…

    View
    TwitterX

    TwitterXThis package loads Twitter feeds/statuses using the new (and…

    View