How to Add Dynamic Navigation Menus to a Gatsby Page Template
Then in the nav bar comp you’d use a graphql static query to pull in the navigation data from a schema that could, for example, be an array of references to all your “page” type, so you can return the current slugs and titles as nav items and have the ability to automatically route directly to pages you’ve made from the studio. I actually just wrote a navigation schema that allows the user to add/remove/edit both singleton and dropdown nav items, but it technically belongs to the agency I work for at this point so can’t post it here for you. Just wanted to explain how I usually approach navigation/routing schemas with Gatsby and Sanity!
Was this answer helpful?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.