I am coding a small fundamental private weblog theme from scratch. Is there any technique to render the desk of content material at the server as a substitute of the use of JS to generate the TOC and injecting it into the web page?
I am making a fundamental weblog theme for myself and I am the use of the WP Gutenberg Blocks to write down my blocks. I am the use of Header 2 (H2) as my segment titles.
I have written a small piece of JS code that appears at all of the H2 titles after which generates the desk of content material at the consumer’s pc (that is tremendous rapid however nonetheless can be nicer if the consumer was once given this as a substitute of producing it on their device)
So I am questioning if there may be any method I will have the server generate the TOC with out the use of JS, ideally with none additional pointless plugin.
View Reddit through ashkanahmadi – View Supply