How to exclude bullet points from the table of contents in a blog using Sanity and NextJs.
14 replies
Last updated: Aug 12, 2021
E
help 👌Hello, please does anyone have an idea about how I can add ✔️`table of content`✔️ to my blog with
sanityand
NextJs.Something like this.
Aug 11, 2021, 7:06 PM
E
Thanks so much
Aug 11, 2021, 8:31 PM
E
user Y
Please how do I exclude the bullet points from the table of contentAug 11, 2021, 9:12 PM
E
No I have these bullet points I created in sanity studio and they are also appearing below the
You might like this
Aug 11, 2021, 9:31 PM
E
No, I created some bullet points in sanity studio and they are also showing. That's below the
You might like this
Aug 11, 2021, 9:33 PM
I don’t have enough context to be helpful here. How does the JSON document of this post look like?
Aug 11, 2021, 9:36 PM
E
{ "_key": "a0392cd68b8d", "_type": "block", "children": [ { "_key": "917c006759dc", "_type": "span", "marks": [ "d84dd0a78456" ], "text": "Sidebar Menu with html css" } ], "level": 1, "listItem": "bullet", "markDefs": [ { "_key": "d84dd0a78456", "_type": "internalLink", "reference": { "_ref": "4ae667f2-5f9d-4b3d-9616-429aa1616867", "_type": "reference" } } ], "style": "normal" },
Aug 11, 2021, 9:53 PM
E
Sorry I could only copy some part because the whole json is too long and slack won't allow me to send it
Aug 11, 2021, 9:54 PM
E
I see that the bullets have level set to 1 on them. But I can't find the level property on the node
Aug 11, 2021, 10:26 PM
E
@knut (he/him) Hi I added some ordered list to your codeSandBox and it was also included in the table of content. Please how do I exclude the ordered list?
Aug 12, 2021, 12:37 PM
E
user Y
No, It seems you don't understand what I meant. Your code works correctly but in your case, there weren't any bullet points in your content. Am trying to say that when there is a bullet point in the content it also gets added to the table of content which is not what I wanted. I only want the h1,h2,h3,h4 to show excluding the bullet points.Aug 12, 2021, 1:13 PM
E
user Y
Please don't worry I have figured it out. Thanks for helpingđź‘ŚAug 12, 2021, 3:59 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.