Skip to content

Wide, index-like TOC #62

Answered by allejo
travelster asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, this is entirely possible. If you have all of those articles in an array, let's say, posts, you would be able to loop through all of them and just feed each post's content into toc.html. Then use the base_url parameter to point to another page (the HTML ID will automatically be appended).

{% for post in posts %}
    {% assign postUrl = post.url | relative_url %}

    {% include toc.html html=post.content base_url=postUrl %}
{% endfor %}

^ that snippet is untested, but that's the idea of how you'd go about generating a site-wide TOC.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by allejo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants