Hey,
i followed this guide to create my table of contents: How to add a table of contents to your Ghost site
But now i have quite a lot of H2 and H3 headings in my blog post. How can i only visualize the H2 headings?
Thanks!
Laurin
Hey,
i followed this guide to create my table of contents: How to add a table of contents to your Ghost site
But now i have quite a lot of H2 and H3 headings in my blog post. How can i only visualize the H2 headings?
Thanks!
Laurin
I think in this particular snippet:
{{! Initialize Tocbot after you load the script }}
<script>
tocbot.init({
// Where to render the table of contents.
tocSelector: '.gh-toc',
// Where to grab the headings to build the table of contents.
contentSelector: '.gh-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: 'h1, h2, h3, h4',
});
</script>
You could try removing all except the h2 heading selectors.
So change that line instead to:
// Which headings to grab inside of the contentSelector element (seems logical, no?)
headingSelector: 'h2',