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.

Sanity treats content as structured data and makes it easily available over an API. The collaborative editor, called the Content Studio, is a fully customizable, client-side web application. Documentation here.

833 questions
0
votes
1 answer

How can I implement a Next.js Image component with a fixed width and dynamic height to keep the image's dimensions?

The image is sourced from SanityCMS, and the current code (ChakraUI styling) I have is: {allArtPieces[0].title}
0
votes
1 answer

Sanity Studio CMS on initialise script (upstart)

Is there a way to hook into the Sanity Studio initialise step? Or perhaps start the Studio from a js module so I can wrap it in some logic? My motive is, in development it can be confusing which Project Instance, Dataset or Project name I'm on. When…
Lex
  • 4,749
  • 3
  • 45
  • 66
0
votes
1 answer

Sanity.io CMS – program a schema type

I've created a Schema Type as below and I'd like to program it so that for each blog post it increments: 1 - first post, 2 - second post, and so forth (then this number will be used on multiple pages). A simple thing, but I couldn't find any…
ytrewq
  • 59
  • 1
  • 10
0
votes
1 answer

Sanity newly added field is not showing on queries

I'm creating a web application using sanity. I added 'likes' field which is a number, to my post schema. I can see likes on my desk, but when I query *[_type == 'post'] I don't see likes field. Also, when I try to increment the field 'likes' using…
Sachin Titus
  • 1,960
  • 3
  • 23
  • 41
0
votes
1 answer

Publish document after creating with sanityClient

I need to insert alot of data into sanity and I will do this with a node script. My issue is that the documents does not seem to publish once I insert them. I use client.create(data) and the data is inserted, but I need to make changes to the…
Moddah
  • 51
  • 1
  • 7
0
votes
1 answer

Sanity groupProblems.js error when running graphql deploy

Has anyone run into 'Cannot read property 'problems' of undefined? happening into /node_modules/@sanity/schema/lib/sanity/groupProblems.js when trying to run graphql deploy I can provide more info on what I added to the schema but it's nothing…
0
votes
1 answer

Connection refused for Sanity API call

I'm using the sanity php client to fetch some data off of sanity. This is my query: $results = $client->fetch( '*[_type == "article" && slug.current == $slug ]{name, intro}[0]', ['slug' => $slug] ); This is the error I'm getting: Fatal…
bstnhnsl
  • 119
  • 5
0
votes
0 answers

Image flicker on custom image gallery

My component loads 2 images and then animates opacity between them to fade into the next image. This is all mediated by a setInterval that changes the index for the images every second. The issue is that just after the first image transitions into…
0
votes
1 answer

Sanity CMS: Get current user from datastore

I'm trying to fetch the current user in Sanity CMS. I found this code snippet which demonstrates use of userStore But I don't understand how I can configure my project to accept this module lookup import userStore from 'part:@sanity/base/user'; It…
Lex
  • 4,749
  • 3
  • 45
  • 66
0
votes
2 answers

Sanity & GROQ - How to fetch items that does not have a category?

I'm trying to access all the items that does not have Featured in their category array. The GROQ code I use is `*[_type == "post" && *[_type == "category" &&title != "Featured"][0]._id in categories[]._ref] {title, 'mainImage' :…
Sachin Titus
  • 1,960
  • 3
  • 23
  • 41
0
votes
1 answer

is there a way to connect to sanity.io database / datastore data from Metabase?

I just found out about Sanity.io and think it is really really cool. But as Im new to it I haven't found a way to connect Metabase ( data analytics ) to sanity's database. Is that even possible? My team is used to Metabase and would be nice if they…
0
votes
1 answer

How to filter API data in sanity.io using react.js?

Hello I am new to the community and learning how things work here. Please try to understand through my broken English. suppose there are 200 data in API, but I just wanted to pull any 4 random data to frontend. To be more clear the data are blog…
thebuggybug
  • 15
  • 1
  • 7
0
votes
1 answer

How to add and display multiple images with sanity.io?

I've tried to add more images in my sanity project without any result. I've add a schema for that. { name: 'gallery', title: 'Gallery', type: 'array', of: [{ type: 'image', options: { hotspot: true, },}] } But when I console.log…
Diego
  • 195
  • 2
  • 8
0
votes
1 answer

sanity-algolia get error when using pt::text

I'm trying to integrate algolia search with sanity CMS using the sanity-algolia library (ref https://www.sanity.io/plugins/sanity-algolia) But when i try to get the plain text from Portable Text rich text content using the pt::text function. i get…
Kim Vu
  • 584
  • 9
  • 25
0
votes
1 answer

How do I get Watch Mode with Sanity.io and Gatsby to refresh content when referenced documents are edited in the CMS / Studio?

I'm using Sanity.io, GatsbyJS 3.x Watch mode works great when you update content in the CMS, except for when the content you edit is part of a referenced schema of type 'document'. Put another way, changes made to a document referenced by another…
Paul
  • 21
  • 2