Watch a live product demo 👀 See how Sanity powers richer commerce experiences

Creating Gatsby Pages from a Table of Contents (ToC)

9 replies
Last updated: Aug 7, 2020
I've made a ToC similar to . But I've also added slug field to the children, so I can build Gatsby pages from the ToC instead of from other documents. But I want to be able to reference these in other objects (
user Y
's example) so I can link to it, but they are objects and not documents. If I change the type of
they still can't be found in a reference. Any ideas?
Aug 6, 2020, 1:28 PM
If I change them to a
and create one from the main folder in the studio it works, but if I create one as a child of
it doesn't show up in the reference list
Aug 6, 2020, 1:33 PM
Creating documents inside other documents (e.g. adding references in place) is not possible yet, unfortunately. It’s a popular feature request and definitely something we want to add support for, but it’s not quite there yet.
At the moment, creating these from the main folder in a different browser tab might be the easiest option, unless you’re willing to venture into unknown territory and try to get this to work in a custom input component
Aug 6, 2020, 2:02 PM
custom input component it is then, gonna look into that 🙂
Aug 7, 2020, 6:25 AM
Or is there any way I could help build this for you?
Aug 7, 2020, 7:08 AM
Appreciate this! The reason we haven't done this yet, is because of the way we do drafts at the moment, which complicates things. We want to fix that first. It’s high on our list, because obviously, being able to create and edit references in place makes total sense.
Here’s part of the discovery:
Aug 7, 2020, 7:40 AM
Yeah, that looks like a logical first step 🙂
Aug 7, 2020, 7:42 AM
But yeah, I'm a bit hesitant to set you out on this course, because it might be a potential rabbit hole, and then suddenly we solved it anyways
Aug 7, 2020, 7:43 AM
yeah, I'll do a temporary solution for now and change it when you solved it
Aug 7, 2020, 7:44 AM
that's totally fine
Aug 7, 2020, 7:44 AM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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.

Categorized in

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

Clean Next.js + Sanity app
- Template

Official(made by Sanity team)

A clean example of Next.js with embedded Sanity ready for recomposition.

Cody Olsen
Go to Clean Next.js + Sanity app

Blog with Built-in Content Editing
- Template

Official(made by Sanity team)

A Sanity-powered blog with built-in content editing and instant previews.

Go to Blog with Built-in Content Editing