Amazon.co.uk Widgets

Log in

X
Automatic Table of Contents generator for Joomla

I had a little plugin to generate my table of contents out of the headers but it never really worked properly, so I today got around to finging a better solution. It works, but its not exactly straightforward, reminding me of an old friend at Sun Microsystems who triumphantly brought a laser printed sheet of A4 paper over and said 'its taken me a week to print this but I've learned a lot about Unix'. Anyway I think my new table of contents in Joomla looks pretty nice. See for yourself, Its below the read more.

TL:DR – Thank you to Clifford E Ford who wrote the example on the Joomla site in 2019.

J4 Plugin example - A Table of Contents content plugin

Turns out someone wrote up how to create a Table of Contents plugin and it was easy enough to customise it for my purposes. YMMV. It is stated as not meant for production but it works well and I've customised it to fit my site style and create a prettier Bootstrap Card with a list in it. 

The plugin code and a working zip file are available on GitHub https://github.com/ceford/j4xdemos-plg-toc

Installing

You can download the plugin from Github,and install in Joomla 5.

Once thats done the plugin should work, you need to insert a toc in braces into an article to see it.

Modifying

I just modified the php code to simplify the styling, using a Bootstrap card and card-text classes in a list. It took about fifteen minutes and looks exactly how I want it, uncluttered and compact in a list in a Card.