-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table of Contents: support usage outside of Post Content #41173
Comments
I totally agree with @ZebulanStanphill I wanted to use the toc in one of my widget areas to create a navigation within my posts. Now it only shows the headings, that are used in my admin-widget-area in all of my posts ^^ I created a workaround via a script that injects all headings dynamically into the menu but that should be the default in my opinion. |
Yes please. I don't think it is currently possible to use the Table of Contents block in the Single Post template for example... I'd have to add it to every post. That's just silly. I want to add Table of Contents block to my Single Post template. |
This is a great Issue, I've ran into the same use-case as @HoffErik-JohnerInst. Would be great if it could be implemented. |
+1 on this i would need it in the single post template |
+1 |
I would expect the table of contents block to always render the headings within the post content, wherever it was added (template, or within single post content itself). @ZebulanStanphill Is that what you're thinking? |
@richtabor Yes, that would be my expectation. |
This is a good opportunity to make the TOC block more robust. When we get down to this, let's also keep in mind the two issues below: |
What problem does this address?
Currently, the Table of Contents block only grabs headings from a post that it resides in. But one use case that I think should be supported is putting the block in the post template, but outside the Post Content.
This would necessarily require the use of dynamic rendering, which ironically was just removed from the block in #29739.
Now, the static rendering approach in the aforementioned PR is certainly a lot better for performance, but it's simply not an option for the outside-of-Post-Content use case.
What is your proposed solution?
What if the block automatically used dynamic rendering when outside of the Post Content, but continued to use static rendering otherwise? Would such a thing be possible?
See #32842 (comment) for a bit of prior discussion.
Some questions the implementation needs to answer:
The text was updated successfully, but these errors were encountered: