-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
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:
- Is it possible to determine whether a block is inside the Post Content or not? And if so, how do you do it?
- How would the "only include headings from current page" option work?
- Specifically, how do you determine which page of a paginated post is being rendered?
- What would it look like in the editor, where the whole post is typically rendered?
- What's the most clean/efficient way to get the blocks of a given post in a format that can provide us all the info we need?