Is it possible to access the toc of a different page than the current page? #7900
-
For example, at the top of
But under a certain condition, I'd like the toc used to be the main page's toc, so that it just links out to the posts on the front page. I'm using the blog plugin and its specifically those titles and urls that I want. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @divSelector,
As for the application, I'm unsure whether it would work like you envision it 🤔, as the You'd also have to extend the theme together with block overrides and modify how the blog-post.html works to replace the toc of a given blog post. Or separate the changes into |
Beta Was this translation helpful? Give feedback.
Hello @divSelector,
accessing different TOCs should be straightforward, there is the global context with:
nav
, which containspages
, a flat list of Page objectsfor page in nav.pages
and thenpage.toc
pages
, a flat list of File objectsfor file in pages
and thenfile.page.toc
As for the application, I'm unsure whether it would work like you envision it 🤔, as the
toc
likely doesn't contain actual links including the file path, but instead they probably just contain the#href_id
nothing more, so you'd have to tinker with it to get the result you want. So perhaps a customtoc.html
is also required t…