Thanks for replying! I have 3 headings. Before I didn’t have as many, and nothing happened. Right now, my previous code above is throwing the following error:
<?php
$headlines = $page->text()->toBlocks()->filterBy('type', 'heading')->filterby('level', 'h2');
dump($headlines); // just to make sure I have headlines
snippet('toc', ['headlines' => $headlines]);
Thanks, I have it working now but it’s different from the recipe.
I don’t have / need a plugin like: /site/plugins/toc/snippets/toc.php ?
I had missed that the snippet goes directly in snippets/toc.php
The last thing that I’m trying to figure out is why the text inside the <a> is using <strong>Headline</strong — and so are the headings created with a prefix and suffix -strong?
Indeed. I copied and pasted some sentence from other site, and as it pasted it with format I didn’t realise of that I guess it’s time to take a break if I didn’t pay attention to this. Thanks for your help.