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.
139
questions
0
votes
0answers
7 views
Preview content on site in Sanity not working
I'm following the Sanity docs on how to add a content preview. After updating the sanity.json and adding a resolveProductionUrl.js file according to docs I should be able to see a menu item in context ...
0
votes
0answers
10 views
Sanity preview not working when I add or change content in Sanity Studio
I've been trying to get live preview in Sanity to work for several days now, without luck.
It works like a charm when I follow this tutorial:
how-to-quickly-set-up-a-gatsby-js-jamstack-website-with-a-...
1
vote
0answers
22 views
Loading SVG images in Gatsby from Sanity
What is the right approach to load SVG images from a Sanity CMS in a Gatsby (v3) website? The Sanity documentation states that
GIF and SVG pass through the image pipeline untouched, but if you want ...
0
votes
0answers
10 views
How does headless CMS support multi user apps
I like the idea the headless CMS bring to the market. But as a backend developer and someone who has just learnt about headless CMSes, it leaves me thinking about how headless CMS APIs communicates ...
0
votes
0answers
21 views
Missing 'fixed' and 'fluid' fields on image asset with `gatsby-source-sanity`
I'm trying to source images from Sanity with gatsby-source-sanity and gatsby-image. In the past I've had no issue querying the fluid image asset like so:
export const query = graphql`
query {
...
2
votes
1answer
36 views
Querying images from Sanity for GatsbyImage
I'm having trouble sourcing images from Sanity using the new gatsby-plugin-image. The documentation says to do the following:
import React from 'react'
import {getGatsbyImageData} from 'gatsby-source-...
0
votes
1answer
20 views
Error when I try to execute 'sanity start' after success with 'sanity init'
I am trying to install the Sanity studio and I followed these steps:
npm install --global @sanity/cli
sanity install
sanity init
After the init step, I try to run the next step:
sanity start
but it ...
0
votes
2answers
28 views
Next.js with Sanity not building Blog pages
I'm working on my first integration of Sanity with Next.Js, trying to add a blog to a personal site. Dev works fine, but when I go to deploy, or do a build, I get an error that it can't find one of ...
0
votes
1answer
34 views
Text highlight is not being applied at front-end in Sanity CMS
I am trying to create a blog using Sanity Headless CMS and React for the frontend.
I have made a decorator for highlighting text. As you can see in the image below, in the editor, the highlighted text ...
0
votes
0answers
25 views
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 ...
0
votes
1answer
24 views
Unable to add code blocks in Sanity CMS after I install the code-input plugin
I am learning to build a blog using Sanity CMS and React. I am new to Sanity.
I should be able to insert code snippets in my blog posts. So, I have installed the code-input plugin.
According to the ...
0
votes
1answer
26 views
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 ...
0
votes
2answers
46 views
How to get just the most recent of all documents
In sanity studio you get a nice list of the most recent version of all your documents. If there is a draft you get that, if not, you get the published one.
I need the same list for a few filters and ...
-1
votes
0answers
16 views
Why is there data that I can access via graphql but not when i fetch it via groq?
I am trying to fetch an img url that I know exists because i can get it from Sanity with graphql.
But when i try to fetch the same data via JS and Groq i can't seem to get the URL as well as other ...
0
votes
0answers
58 views
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).
...
2
votes
1answer
47 views
Dynamic pages at load time, not build time
I'm building an editorial site that regularly adds new content. As such, they've requested that articles and article content is loaded in at load time rather than having to run a build and wait for it....
1
vote
1answer
42 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
2answers
38 views
NextJs Google fonts issue - Only one font gets displayed
I'm connecting Google Fonts link to the HEAD section in _app.js file of my NextJs application. The link contains two fonts.
https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&family=...
0
votes
0answers
38 views
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 } ...
0
votes
1answer
52 views
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'...
0
votes
1answer
16 views
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:
@...
1
vote
1answer
49 views
How to Async/Await using useEffect for fetching data? [duplicate]
I have looked up some questions but didn't manage to fix this issue. I am trying to add async and await to my useEffect where I am fetching for data.
Also, how can I add a simple loading text before ...
1
vote
1answer
40 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:
...
0
votes
1answer
56 views
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 ...
1
vote
1answer
69 views
Problem with rich text that I get from Sanity
import React from "react"
import {
Link,
graphql
} from "gatsby"
import Image from "gatsby-image"
import BlockContent from "@sanity/block-content-to-react"
import Layout from "../components/...
0
votes
1answer
88 views
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 ...
0
votes
0answers
37 views
Sanity Integration with Next Project
I am integrating sanity with my nextjs project. I have installed the sanity/cli using
sudo npm i -g @sanity/cli , now when i am doing sanity init getting error
Unhandled rejection: Error: EACCES: ...
1
vote
1answer
68 views
Is there a way to get a structure of a Strapi CMS Content Type?
A content-type "Product" having the following fields:
string title
int qty
string description
double price
Is there an API endpoint to retrieve the structure or schema of the "Product&...
1
vote
1answer
57 views
Convert String type to slug type for sanity io
I am importing data from an external API into my sanity schema and the API contains the slug in the form of a string. I have tried removing the double quotes of the string and making it single quoted ...
0
votes
0answers
7 views
Need to generate a Mendoza patch
I was going through sanity.io/blog/mendoza#run-your-own-mendoza-ab404c6e1b29 and wondered if we can generate the Mendoza patch given two different JSON objects ?
I have not found any relevant ...
2
votes
1answer
159 views
Sanity.io GROQ query for array of objects
I'm learning to code and now I am on the stage of a small pet project with Sanity as a CMS.
Long story short, making an API I'm trying to fetch cocktails data with votes for the cocktails. The votes ...
2
votes
1answer
54 views
Is it possible to query document schema metadata in Sanity/GROQ?
I have a simple singleton document schema defined in my Sanity/NextJS project, to model my "Colophon" page (richText is a custom block field type):
export default {
title: 'Colophon',
...
1
vote
1answer
53 views
…GatsbySanityImageFluid - Cannot read property 'fluid' of null
I'm working with Sanity and Gatsby
I'm trying to map over an array of images to display them in an image gallery. My GraphQL query is working, I am able to display a single image but I receive the ...
-1
votes
1answer
41 views
Sanity part is not responding in my React app
Sanity
I have created this file blog.js in sanity studio under the Schema folder
enter image description here
React
import React, { useEffect, useState} from "react";
import sanityClient ...
0
votes
0answers
26 views
Adding an external URL when clicking an image with the rich text editor of Sanity
I'm trying to make possible for the people using the rich text editor in sanity.studio (with no coding knowledge) to add an external link in the image they are uploading. So, then it is clickable in ...
0
votes
0answers
21 views
Put existing labels into list and change names based on list indices?
I have 22 labels. Half have DISCNumX and the other half have TOTNumX where X is a number 1 through 10, respectively. I've stored the values that the label text needs to be updated to in a list. I'...
1
vote
0answers
63 views
Gridsome - “category not defined on the instance but referenced during render”
I am using the Gridsome blog starter, and I am trying to add a categories list above the posts:
Below is the query. While it works as expected on the /__explore,
on the app itself, I am getting the ...
3
votes
1answer
106 views
Escape HTML entities and render URL dynamically
The problem can be seen here
I built a site using Sanity headless CMS and GatsbyJS on the frontend.
I'm querying URLs dynamically so that it can be rendered inside the src attribute of an </iframe&...
1
vote
0answers
53 views
How to auto-populate referenced documents in a Sanity.io schema?
Here are the relationships I have:
Artists
Artworks -> references Artist from Artists
What I would like to do is view all the Artworks that reference a particular Artist inside the Artist Document ...
-1
votes
2answers
20 views
how to create code for sanity testing auto screen capture?
Fast screenshot
How to easily take screenshot of my screen in windows 10?
I would like to have option to select a part of my screen to take the screenshot.
2
votes
0answers
68 views
setPreviewData on Next.js /api serverless throws error (not a funciton)
I'm using next.js for presenting data from sanity.io and I'm deploying it as a serverless application on AWS (edge-optimized). At first this functionality was working but at some point it just stopped ...
0
votes
1answer
222 views
Error: No “sanity.json” file found in plugin “@sanity/base”
I am new to sanity and trying to follow along to a tutorial on youtube but I am getting this error when I run ' sanity start'. Can anyone give me advice on what I should do?
sanity error
1
vote
1answer
161 views
Resolve reference in Block Content in Sanity.io
I have the Content Block in Sanity like so:
export default {
title: "Block Content",
name: "blockContent",
type: "array",
of: [
/// stuff here
{
title: &...
1
vote
1answer
93 views
How do I access an asset's URL when linked via reference in Sanity Studio?
I want to upload PDFs in Sanity Studio, then link to those PDFs in the main site content.
I've added a reference to a document which has a 'file' field in it to my simpleBlockContent input in Sanity ...
-2
votes
1answer
84 views
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 ...
0
votes
0answers
134 views
Sanity CMS, referencing arrays within a document
My goal is to have a custom internalLink mark that is able to reference not just the post (which is easy enough since its a type: document) but also reference name: sections which returns array of ...
0
votes
1answer
108 views
“sanity init” command fails at “Resolving dependencies”
I just wanted to create a new Sanity project. After running npm install -g @sanity/cli, which worked fine, I run sanity init. At the last step it crashed with the following warning:
Error Message From ...
0
votes
0answers
21 views
May I Preview Multiple Properties from Array Values?
From the Sanity docs, we see how to preview from array values
export default {
name: 'book',
type: 'document',
fields: [...],
preview: {
select: {
title: 'title',
author0: '...
0
votes
0answers
33 views
How can I override the grid-gap property in Sanity Studio?
The styling guide on sanity.io explains overriding css variables with a 'part'.
Simple enough, but none of the available variables appear to cover the grid-gap property on the ObjectInput_fieldWrapper:...
0
votes
0answers
64 views
How to project content from an array of object In sanity.io
I have an array of object that contains an image. How do I return just the values I need from the object? E.g
{
"firstName": "John",
"lastName": "Doe",
...