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

We have about 13,000 documents - most of which we have imported manually using the sanity cli. For some reason none of these are showing up on our site without using a token....

13 replies
Last updated: Dec 29, 2020
We have about 13,000 documents - most of which we have imported manually using the sanity cli.
For some reason none of these are showing up on our site without using a token. What's odd is that when I manually create a new document, it shows up just fine. I
have checked several imported documents to see they meet the required fields and are published - but to no avail.
I have no idea why imported documents are not showing, but newly created ones are.
Dec 29, 2020, 1:20 AM
Unfortunately we're realising this just a few days before the content team are taking over to update content before a big launch.
Dec 29, 2020, 1:21 AM
• The dataset is public• I've made sure the documents meet validation requirements
• I've made sure documents are published (even toggled on and off)
• They DO show when using a token so I don't think it has anything to do with my groq queries
Dec 29, 2020, 1:25 AM
When you export your dataset, can you see any differences between the documents you originally imported and the new ones you created manually?
Also, if you reimport, do the documents you had created manually no longer appear?
Dec 29, 2020, 2:13 AM
Are there any dots
in the imported document ids? Documents on a path will always be private
Dec 29, 2020, 7:08 AM
Ah yes a lot of them (not all) have dots, like

This is because I read somewhere in the Sanity docs that using this will allow for some more interesting grow queries.
user J
Dec 29, 2020, 8:53 AM
Considering how many documents we have, can you think of an affordable solution to this?
Changing each one will drive up our quota a lot.
Dec 29, 2020, 8:54 AM
Yes, it's a bit of a hidden footgun that paths are always private. Sorry about that.
Running a script that strips off that path in the ids should be fairly straight forward. You can do multiple (hundreds) of mutations in a single transactions. I'll see if I can dig out an example for you..
Dec 29, 2020, 8:57 AM
I think the "easiest" solution for you would be to use the CLI to1. export the dataset
sanity dataset export
2. modify the data locally (strip off the paths) using a script or search and replace
3. import the dataset
sanity dataset import
to a new name4. update the studio and front-end to use this new dataset
Dec 29, 2020, 9:06 AM
(since document ids are immutable using a script to mutate would be a bit more involved)
Dec 29, 2020, 9:08 AM
Thank you! Just to clarify though, as they would have different id's - reimporting then wouldn't replace the previous document. That's why I need a new dataset?
Dec 29, 2020, 9:14 AM
Yes, that's why I thought having a new dataset would be the best solution. Otherwise you would have to delete all the "old" documents.
Dec 29, 2020, 9:38 AM
Also, I just realised.. are there any references to the documents on paths? If so you will have to update all the references as well with the updated ids
Dec 29, 2020, 9:39 AM
Fortunately not many of them are referenced, and those that are will be caught by the editors.
Thanks a lot
user J
Dec 29, 2020, 10:07 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