I’m trying to generate a table contents based on the <h2> lines in my page. I’ve tried using the toc.php with a (toc) callout in the text file, but that isn’t working for me (and others seem to indicate that it isn’t linked anyway). Ideally, I want a list that links down to each <h2>, and then if you click the <h2> it will take you back to the top of the page. It seems like this should be easy (and it is in plain HTML), but I just cannot get it to work in Kirby.
Strange, that should work, at least in one direction. You’d have to add the toTop functionality, though. I just added the file to a new Starterkit and it does work without any problems. Are you rendering the content of the field with the kirbytext() method?
I thought I was rendering it properly with the kirbytext() method, but like another user, the page simply prints (toc) where the content list should appear. Is
No, the h2 elements get an id through the code, the id is created from the text between the opening and closing heading tag: str::slug(str::unhtml($match[1]))
Hello @texnixe, I’m trying to generate a table contents with the starterkit and I’ve got some issues, is it possible for you to send me your working starterkit ? Thanks