Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Use TOC plugin in template

Started by Muut Archive 11 years ago · 2 replies · 623 views
11 years ago

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

TWIG
{% 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].

11 years ago

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

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2288 9 years ago
Archive · by Muut Archive, 9 years ago
2 1500 9 years ago
Archive · by Muut Archive, 9 years ago
2 4750 9 years ago
Archive · by Muut Archive, 9 years ago
1 3565 9 years ago
Archive · by Muut Archive, 9 years ago
3 1625 9 years ago