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
2 answers

How do you do CRUD in Gatsby with Sanity as my backend

I am now about knee-deep in a new Gatsby 4 project and may have hit a wall. I can't figure how to do CRUD in Gatsby with Sanity as my backend. Can I do GQL mutations in Gatsby GraphQL? I can't find any examples or tutorials anywhere. I have done…
Tithos
  • 1,191
  • 4
  • 17
  • 40
0
votes
1 answer

Sanity posts display all categories, not just ones associated with post

I am working on making a blog using React and Sanity, and I want to display the categories associated with each post underneath each post. I am able to display the categories, but it displays all categories, not just the ones associated with each…
Brandon Pyle
  • 307
  • 3
  • 14
0
votes
1 answer

Best Way to Add Syntax Highlighting to Code Block - React Sanity Blog

I am trying to find the most efficient way to add syntax highlighting to my react sanity.io blog. Here's the article component that I created using react: import React, {useEffect, useState} from "react"; import {useParams} from…
0
votes
1 answer

Failed to load resource: the server responded with a status of 400 () React.js

This is my first time using sanity building a blog website for practice using React JS where I am supposed to call a API from sanity.io. But my React website is not able to fetch the data from Sanity. At that area of webpage where there should be…
gatwirival
  • 195
  • 2
  • 18
0
votes
1 answer

Sanity.io groq filter inside an array of objects using a reference field

I've been stuck for a while trying to optimise my groq query. I have page content that contains an array objects (different languages). I've been playing around in Sanity Vision to see how I can filter the output so that I only get the content in…
Tanpo
  • 233
  • 3
  • 18
0
votes
0 answers

SANITY : How to implement query and params?

I did this query in vision and finally got what I needed but is this the correct way to implement Sanity's query & params on react ? import { useState, useEffect } from "react" import client from "../client" export default function Homepage() { …
0
votes
1 answer

Sync sanity database to salesforce

I have some sites made with sanity. So I want to sync my sanity database to salesforce. If I get a better flow or idea or links it will help
0
votes
3 answers

How to fetch Sanity blog categories?

I created a blog using React & Sanity but I couldn't find how to get the blogpost categories or category. import {useState, useEffect} from "react" import { Link, useParams } from "react-router-dom" import client from "../client" import BlockContent…
0
votes
0 answers

Sanity intl plugin / Allow GraphQL to query __i18n_lang by removing the underscores from field name

GraphQL ignores fields that start with double underscore __i18n_lang and I cant query the language from Sanity. The Sanity Intl plugin has already a solution how to replace the name but the Docs are not very friendly for a Sanity beginner like…
Jozefini
  • 173
  • 1
  • 11
0
votes
1 answer

npm run graphql-deploy command stuck in Sanity

When I am running, the command npm run graphql-deploy in my local it stuck at lerna info Executing command in 1 package: "npm run graphql-deploy". Not moving forward. And if I run same command in studio folder it stuck at: GraphQL API deployed…
Aman Sharma
  • 153
  • 1
  • 4
  • 12
0
votes
1 answer

Looks like apolloClient does not query entries with id that has . (dot) in them using NextJS and SanityCMS with GraphQL

I have a SanityCMS with some data and localization (translations) and when the documents gets created they get a ID that looks something like i18n.b4d654f7-2b47-4339-9a92-d9ad5d111b43.no where the last seperation is the locale/language. When i use…
Kim Vu
  • 584
  • 9
  • 25
0
votes
1 answer

Building a blog with React & Sanity.io - (import/no-anonymous-default-export)

This is the code for my blog page. import React, {useState, useEffect} from "react"; import { Link } from "react-router-dom"; import sanityClient from "../client.js" export default function Post(){ const [postData, setPost] =…
Josh
  • 1
0
votes
1 answer

GraphQL using a dynamic ID from set of returned results to render correct set of data

I am pretty new to graphql, so my question might sound a bit strange. it may not be correct way of doing what I need, but I can't think of any other way. Basically, I would like to know how I can use an ID i am being returned from my graphql query…
Hellodan
  • 1,158
  • 4
  • 18
  • 38
0
votes
0 answers

How to fetch data from sanity to Nextjs

I'm new to sanity and data fetching in Nextjs but I'm familiar in axios and fetch method. How do you guys fetch your data from your deployed Sanity project? Here, I tried to fetch my data but it returns "undefined". const client =…
user17295940
0
votes
1 answer

Section images will not display when pulling from sanity io data base

Currently building my portfolio site using Next.js and Sanity for my CMS. I've managed to pull the featured image for a project using the useEffect and setImageUrl method. I'm trying to pull images to display on the front end for different sections…
Kristian Abenojar
  • 173
  • 1
  • 1
  • 5