Programmatically generate page links? #21
-
|
I noticed that in the SideNav component on the docs site, the links are generated from an array that contains all the information. Is there a preferred way to programmatically generate links? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
@farleykr I think it depends on your implementation. You could scan through all the pages at build time to create a "content manifest" (as we do here), and use that data to generate the side nav. However, typically you want more control over the order of the side nav items, as well as which pages show up, so hard coding it somewhere is probably your best bet (we do something similar at Stripe as well). |
Beta Was this translation helpful? Give feedback.
-
|
This use case reminds me of Contentlayer; they're currently discussing support for Markdoc over there, and I think this could be an epic collab :) |
Beta Was this translation helpful? Give feedback.
@farleykr I think it depends on your implementation. You could scan through all the pages at build time to create a "content manifest" (as we do here), and use that data to generate the side nav.
However, typically you want more control over the order of the side nav items, as well as which pages show up, so hard coding it somewhere is probably your best bet (we do something similar at Stripe as well).