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 to query a fallback document if there's no document available for current locale in Sanity Studio?

I am working on a multi-lingual project. Which has 3 locales en-SG, en-VN, and vi-VN. Among them, en-SG is a default locale. Is this possible to query the docs in a way so that when there is no doc for any locale(especially en-VN) the site shows the…
0
votes
1 answer

How do I map across a nested array of objects?

So my issue is this, I'm using Sanity.io to manage content in an illustrator's portfolio page. I'm trying to access an image gallery I've put into every project the illustrator has done. My data is nested like this: data structure I'm trying to…
0
votes
1 answer

Setting up Sanity Client On Both Local & Production Environments

How can I set up @sanity/client on both vercel and a local development? Right now we have it set up on vercel, but I would like to do some local development on the site, but I don't know how to set up the environment variables on my local…
Moshe
  • 6,011
  • 16
  • 60
  • 112
0
votes
1 answer

Using an If statement in React

I am fairly new to coding with React. I'm trying to use an if / else statement and then use the result within the body of the content. Also, another bit of important info is that this is linked to Sanity CMS so I am pulling the content from a…
0
votes
2 answers

How do I change the timezone of my GraphQL time?

I've found a lot of good info on using Date() and getting timezones, but something just isn't working. I have my GraphQL (sourcing from Sanity) set to use formatString, like this: export default function MinutesItemGrid() { const { minutes } =…
0
votes
0 answers

How do I loop over an array within a map of a GraphQL

I'm trying to loop over data from Sanity using GraphQL. I've set up my .map to loop over the larger information and return an array of everything, which is working well; however, when it comes to the arrays within my .map I can't seem to figure out…
0
votes
0 answers

Loading (StaticQuery) - Gatsby site doesn't load in Netlify production but works fine in development

This one has stumped me. I'm using Gatsby, Sanity, and Netlify and everything in development has worked as expected. Now, when I load my site on Netlify (no build errors) all I see is a white screen with "Loading (StaticQuery)". No errors whatsoever…
Riley Cook
  • 85
  • 1
  • 6
0
votes
1 answer

Gatsby Styled Components plugin: window is not defined

I'm getting the following error inside my Gatsby with Sanity app on running npm run build: WebpackError: ReferenceError: window is not defined (from plugin: gatsby-plugi n-styled-components) Seems to be that the external package…
sanderdebr
  • 120
  • 3
  • 8
0
votes
4 answers

Attempting to use Sanity.io CLI results in 'zsh: command not found'

I am having a problem running Sanity's CLI. I have installed the CLI with npm install -g @sanity/cli which works without a problem, and everything is installed correctly (as far as I can tell). However, trying to use any of their CLI instructions,…
0
votes
0 answers

Post.js is not showing the blog post...Are there any errors here?

There should be a block of blog post here but its empty: Please check the map and the other syntaxes, I am not getting it. import React,{useState,useEffect} from "react"; import { Link } from "react-router-dom"; import sanityClient from…
Pranab Das
  • 69
  • 1
  • 7
0
votes
1 answer

Gatsby Query for specific post using slug

I'm attempting to query for a specific blog post using the slug - so that a specific post is shown depending on the slug. I have encountered the following error: TypeError: Cannot read property 'Title' of null This is the logic to the below…
0
votes
1 answer

Trouble Overriding CSS Variables in Sanity.io

I am attempting to change the styling of Sanity Studio as noted here in the docs: https://www.sanity.io/docs/styling#d7f9b5cc2adb As such, I have created a file with the following css variables: @import…
Moshe
  • 6,011
  • 16
  • 60
  • 112
0
votes
1 answer

Filtering Content in Sanity Studio

I am wondering if it is possible to filter content in Sanity Studio according to set criteria. For example, return all published posts or all posts within a particular category, etc. Here is a short video showing what I mean: …
Moshe
  • 6,011
  • 16
  • 60
  • 112
0
votes
2 answers

Add pagination to Next.js & Sanity.io page

As described, I would like to add pagination on a page, where I'm fetching data from Sanity. I'm using getStaticProps for fetching data, and I know that getStaticProps works at build time, so how can I add pagination? Should I kind of pre-build…
Ivan93
  • 11
  • 1
  • 2
0
votes
1 answer

Gatsby not watching sanity for new published changes

I have a Gatsby site deployed to netlify. In development mode I set the option watchMode:true of gatsby-source-sanity in gatsby-config.js and this works fine to watch sanity studio for changes but in production it does not. I have tried adding a…