Questions tagged [sanity]
Sanity is a structured content platform and API that also offers an open source, React-based Studio that functions as like a headless CMS on top of the Sanity APIs.
811
questions
1
vote
1
answer
51
views
I have an issue with my ecommerce web application
Can anybody help me with this error? I followed an ecommerce example application, but at the end, I encountered an error when I clicked on "Shop Now." This is the message I received:
Server ...
1
vote
1
answer
577
views
Create dynamic initialValue for String type field in Sanity
I have a document in Sanity. There are three fields- title (string), slug (slug) and path (string).
How can I use initialValue on the path field to show a custom dynamic string based on the slug value?...
1
vote
1
answer
295
views
Next.js and snapscroll not scrolling to top of page on route change
Snapscroll and height:100vh together seemed to be causing a problem where changing pages would not be showing the 1st element, instead were either influenced from the pages previous position, or the ...
1
vote
2
answers
957
views
Cannot fetch data from Sanity.io -- Unable to parse entire expression -
I am working on React App, nothing much in it a basic website.
I followed the docs from Sanity about creating the blog. I have used Sanity earlier and back then it was working fine on other project.
...
1
vote
3
answers
537
views
Sanity wont let me login through terminal/console
I was logging into my sanity account through terminal or console but it didn't seem to work since it was aborting the process automatically!
Anyone here know how to fix this thing?
C:\Users\Realtrickz\...
1
vote
1
answer
152
views
Is it possible sanity asset make private?
Sanity team said "Asset files are not private, so even images uploaded to a private dataset can be viewed by unauthenticated users."
(https://www.sanity.io/docs/keeping-your-data-safe)
The ...
1
vote
1
answer
334
views
How can I post documents using Sanity?
I'm using sanity cms for an application, and I have some documents stored on db. Which query should I use the create another document in the database from my frontend?
1
vote
1
answer
78
views
Why I can't get categories?
Does anyone know why I can't filter out the categories?
Error: Objects are not valid as a React child (found: object with keys {_key, _ref, _type}). If you meant to render a collection of children, ...
1
vote
2
answers
524
views
Unknown block type "youtube". Problem with serialization React Portable Text
I added custom block YouTube block using this tutorial. I have problem with render the YouTube embed in a frontend.
[slug].tsx file:
import { GetStaticProps } from 'next';
import Header from '../../...
1
vote
1
answer
258
views
Fetching data from Sanity in lib/ files or __layout.svelte for Sveltekit + Sanity integration
I can't seem to fetch GROQ results within a __layout.svelte file or even within libs/Footer.svelte for example
GROQ (found in index.js):
export async function get() {
const data = await client.fetch(...
1
vote
1
answer
1k
views
How do I limit the amount of document inside a schema in Sanity?
I have a Schema called Blog and I only want there to be one Blog object and want to limit it to only one Blog object.
For example, Blog has an "Article". I don't want there to be multiple &...
1
vote
1
answer
420
views
How can I filter slug data
I'm using sanity to get slug data and I just wan't to show related posts from the same post category.
I tried to fetch all data and pass it to the state. but I have no idea how to get current posts ...
1
vote
1
answer
66
views
React button not rerendering the component
I am making a blog with React and Sanity, and am trying to use buttons to allow the user to sort blog posts by tag (category). Currently, the sorting works fine if I hard code the tag I want to sort ...
1
vote
1
answer
1k
views
Nuxtjs and Sanity CMS - $sanity.fetch() returns null on page change in asyncData
I'm using NuxtJS with Sanity CMS.
I've setup a few page components, of which each page component is using the asyncData hook to fetch data from the CMS to display the page.
My page components all ...
1
vote
1
answer
159
views
Can I use Sanity.io for my own data structures or just pre defined ones like 'Blog'
I've just setup a sample blog installation. I thought I would be able to define my own data structures but can't see it.
There is a settings page but I can't figure out what it is showing me
Please ...
1
vote
2
answers
2k
views
Sanity.io API upload images from URL
Cross post from slack#help channel...
I'm creating a Sanity/Nuxt site for a client that includes a blog component. His primary marketing source is Instagram and since Instagram's API only allows for ...
1
vote
1
answer
2k
views
Sanity.io - Image URL exposure for preview/select
I have been using and enjoying Sanity and am currently doing a reasonable sized CMS build with this. I am attempting to set some "preview" images for a gallery of images (using type array).
...
1
vote
1
answer
788
views
add block-input from sanity.io to next.js blog post
I'm developing a blog on next.js with sanity.io, and I'm having trouble using the code-input plugin.
What I do have
I'm able to use the code component block on sanity, which looks something like this:
...
1
vote
1
answer
738
views
Groq: join to a document field
I have a schema that reads something like this: a Page (document) has an array of Items (object); each Item can have a Post (document); each Post has several Tags (document).
I have got most of the ...
1
vote
1
answer
268
views
Lunr - gatsby-plugin-lunr - Can I alter data / index on build?
I've got a Gatsy-Sanity project that needs a search component. For this I though of using gatsby-plugin-lunr. I run into a problem that my nodes are multilingual. For example one of my fields is ...
1
vote
3
answers
4k
views
React-Router-Bootstrap <LinkContainer> Error: You should not use <withRouter(LinkContainer) /> outside a <Router> - Gatsby problem?
'm creating a project using Sanity and Gatsby.js. I'm theming using react-bootstrap. The Link I'm tying to create with LinkContainer from react-router-bootstrap
But I can't seem to get it to work. In ...
1
vote
1
answer
26
views
NextJS + Sanity + Square, where does User data live?
I am building a NextJS E-commerce app that uses Sanity as a CMS and the payment processing is being handled through Square. The client wants a new website with all of the previous user data from their ...
1
vote
0
answers
470
views
How to dynamically create a structure for a desk in Sanity?
Experimenting with Sanity Studio and looking to create a desk with a defined schema based on a referenced array of objects that would be stored in an external file. Given the sample array of objects ...
1
vote
0
answers
260
views
Astro.js Image Sharp error + sanity integration
I am trying to create a simple web app using Astro that will have headless CMS using Sanity.
I was having issues with Astro Image component when trying to use it with statically imported image - That ...
1
vote
2
answers
75
views
Internal Server Error on Production with NextJs 13, sanity and netlify
Description
I am using next js and hosted website on netlify with cms being sanity
The page (blog page) which uses sanity for content return 500 (Internal server error), on hosted site on netlify
But ...
1
vote
0
answers
289
views
Force Build Time Static Generation in Next.js 14.X
I have a blog built with Next.js 14.0.3 which calls a headless CMS API (Sanity) and I host it on Vercel. I've configured sanity to rebuild my site when I publish something new but I have run into ...
1
vote
1
answer
120
views
Sanity.io nextjs (next-sanity) example client
I'm attempting to migrate from sanity v4 which means I'm also upgrading from nextjs 13.4 to next 14, to next-sanity v7. The biggest hurdle seems to be going from v4 to v5, which is why I am attempting ...
1
vote
0
answers
37
views
Pages updated with ISR on Next.js revert to old version when you press back button
We have set up a headless site with Sanity as CMS, using Next.js 13.1.1 running on Vercel.
After the site is built a user can update a page in Sanity, and using ISR (Incremental Static Regeneration) ...
1
vote
0
answers
246
views
Cannot get final name for export 'Observable' of __barrel_optimize__
I've started experiencing these issues after adding Sanity to my Next.js/Typescript app.
Cannot get final name for export 'Observable' of __barrel_optimize__?names=Observable,lastValueFrom!=!./...
1
vote
0
answers
201
views
Why am I getting back empty results from Sanity in my Nextjs generateMetadata function?
First Next.js project and using app router but for context I already have a Sanity backend in production utilizing a different framework (RIP Gatsby).
Per the Next.js docs on how to dynamically create ...
1
vote
0
answers
109
views
Sanity.io content updates are not instantaneous in Next.js
I am developing a project with Next.js and Sanity.io. I pull the necessary data with the client, assign them to variables and return the structures on the internal pages. However, I have such a ...
1
vote
0
answers
88
views
Bi-directional relationship schemas in sanity
I'm working on a project where I have two types of schemas in Sanity: 'Member' and 'Project Group.' Each 'Member' schema references a 'Project Group,' and vice versa. What I'm looking for is a bi-...
1
vote
1
answer
489
views
Next.js undici AbortError - how to debug?
I have a Next.js 13.4.13 site fetching data from Sanity.io with next-sanity. However, whenever I boot up two things are happening:
new updated data from Sanity is not being fetched
I'm getting a huge ...
1
vote
0
answers
521
views
Next.js 13.4.13 (app router) data revalidation randomly no longer working
I know it's not helpful, but I have no idea why or what has changed to stop my revalidation. I have a sanity.io + next.js project where I am using GROQ to call and fetch new data, which has been ...
1
vote
0
answers
195
views
Sanity Client - TypeError: Object is not a function in defineHttpRequest
I'm trying to setup a connection with Sanity with my local build, however I'm getting the following error when configuring my client.js file.
TypeError: Object is not a function. (In 'Object(...
1
vote
0
answers
530
views
PortableText Typescript Error with Sanity.Io in Nextjs Application
I am upgrading my NextJs/Sanity application to NextJS 13 using Sanity.io and typescript.
The PortableText tag no longer works. The value and components attributes are flagged as an error in Visual ...
1
vote
0
answers
129
views
Next.js project deployed on firebase and the content fetched from sanity
I have a project deployed on firebase and the content from sanity and this is the code of fetching the data from sanity
export const getStaticProps = async () => {
const sliderQuery = '*[_type == ...
1
vote
1
answer
479
views
Next.js & sanity | Error occurred prerendering page "/" while npm run build
Next.js application uses sanity,
I tried so many things but none of them worked for me,
Every component is exported and imports are also correct.
while doing npm run build application gives following ...
1
vote
0
answers
193
views
Setting the width of a field in sanity studio
I'm new to Sanity and currently having a play around building a small project. I have the following schema to create a Heading component my issue is I can't see anything in the docs about setting ...
1
vote
0
answers
16
views
Sanity Studio commands not working and encountering syntax error on Mac M1 with Visual Studio Code - How to troubleshoot?
Getting syntax error while accessing local host of sanity studio.
Uncaught error: The requested module '/schemas/testimonials.js' does not provide an export named 'testimonials'
http://localhost:3333/...
1
vote
1
answer
249
views
Using custom list preview with prepare in sanity schema fails production build
I am fairly new with next.js, typescript and sanity, and so far everything was going fine. I have multiple schemas defined in my project and it runs fine in development. linting checks do not return ...
1
vote
1
answer
169
views
Unable to Style Sanity Content using BlockContent
guys I need some help regarding styling my sanity content, So the issue is I'm trying to style the code block, but I'm not able to do so, when I style other items like h1, h2, h3, etc. then the code ...
1
vote
0
answers
214
views
Sanity Studio v3 sanity.cli.js: What should the dataset value be when I have multiple environments?
I have recently upgraded to Sanity Studio 3 from version 2, and I find that I am a bit confused on what I should do with the dataset property in the sanity.cli.js file. This is the minimal example ...
1
vote
0
answers
109
views
Creating a 3-Level Hierarchical Sanity.io Schema for Efficient Content Management
I need help creating a Sanity.io schema that allows me to structure content in a hierarchical manner like the following:
- Hub 1
- Guide 1
- Chapter 1
- Chapter 2
- Guide 2
- ...
1
vote
0
answers
356
views
How to configure sanity preview to work on live?
I'm using the starter template sanity provides https://github.com/sanity-io/template-nextjs-personal-website
The preview is looking for the location from req.query object which is console logging as ...
1
vote
2
answers
730
views
NextJs not getting data from sanity
I am new to sanity and I am trying to replicate a tutorial, but when I get the stage of returning data from sanity, it just shows undefined when i console logged the elements I am trying to get from ...
1
vote
1
answer
143
views
How to make studio content changes locally in Sanity
Currently, I have a Next.js site that is using Sanity. If I'm in my local environment and make changes to some content in my Sanity Studio (localhost:3000/studio), the content I add gets added to my ...
1
vote
0
answers
433
views
Prerendering error when deploying next js, sanity project?
I have the following error usin Sanity cms with Next.js 13
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: fetch failed
at ...
1
vote
0
answers
227
views
Update document fields using Sanity.io CLI
I want to bulk update a single field on 100+ documents of the same document type.
With the goal of keeping my import file as slim as possible, I want to just be able to include the _id and the key/...
1
vote
0
answers
96
views
NextJS PortableText not receiving content from SanityCMS
Using the NextJS cms-sanity example code.
The development site is running fine. There are 2 posts in SanityCMS, both with content saved in the content field.
In studio/schemas/post.js there is the ...