Use TOC plugin in template

Using the development-branch of the TOC plugin, there is a filter called tocify, which I use like this:

{% set toc = page.content|tocify %}
{% include 'partials/toc_default.html.twig' %}

Within {% block content %}, but {{ dump(toc) }} returns nothing. Does anyone have an example of returning the HTML-output from the TOC plugin in a template? I’d like to use it in a sidebar, rather than in the content itself through [TOC].

Hi @gingah there is currently an open issue about that, see . Feel free to join. There is also given an example in my comment. Due to a bug and one change, it is highly recommenended to update your plugin with the latest develop branch changes.


Excellent, the recipe there worked as expected, thanks for the update.