All Questions
32
questions
4
votes
2
answers
2k
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-...
3
votes
1
answer
2k
views
GraphQL - Gatsby.js- React component. - How to query with variables/arguments?
I have a React Component that needs to query data. And I want to pass arguments/variables to the query. But I don't know how to do that.
For example. I have this blog item carousel that wants to query ...
2
votes
3
answers
3k
views
My Gatsby GraphQL schema wont update with new Sanity schema
I am trying to update my CMS to enable a user-defined product slider. Upon adding the relevant schema to my sanity source files (This works) and adding the documents to the schema there is no update ...
2
votes
1
answer
978
views
Reasoning with _raw and normal data in Gatsby, GraphQL and Sanity
I've just started using Gatsby with the Sanity headless CMS.
For the most part it's pretty straight forward; but knowing best practises for querying the data through GraphQL is still bothering me. ...
2
votes
1
answer
1k
views
How to create custom resolvers for Gatsby page queries?
I have a Gatsby application pulling data from Sanity.
This is Sanity's schema for the course.js:
import video from './video'
export default {
// Computer name
name: `courses`,
// Visible ...
2
votes
1
answer
683
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
1
answer
423
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
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
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
1
answer
371
views
How to query Sanity blog post with Gatsby
I have a Gatsby site set up with Sanity CMS for blogging. Current I am unable to properly target individual blog post(clicking on "First Blog" link will render content from "Second Blog&...
1
vote
1
answer
1k
views
Sanity reference to type comes as 'reference'
In Sanity I've got this field:
{
name: 'reference',
type: 'reference',
title: 'Link Reference',
to: [
{ type: 'post' }, { type: 'questionPost' }, { type: 'linkCategory' }, { type: '...
1
vote
0
answers
654
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 ...
1
vote
0
answers
204
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 ...
1
vote
1
answer
486
views
How can I filter child arrays in Gatsby GraphQL?
This gets me all events with showOnSite === true:
query MyQuery {
allSanityP2Event(filter: {showOnSite: {eq: true}}) {
edges {
node {
showOnSite
title
relatedEvents ...
0
votes
1
answer
210
views
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 ...
0
votes
1
answer
1k
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
1
answer
310
views
Resolved: Sanity.io Deploy fails even though local host says query exists
I have been building a website with Sanity.io (Netlify) It is working perfectly fine when I'm using localhost. However, when I deploy the site to Netlify, graphql query reverts back to the beginning ...
0
votes
1
answer
292
views
How to explicitly set schema field type to [SanityImage]
I want to set an images field in my document to an array of type [SanityImage].
I have tried setting it to type: 'image' but when I query the field I get that the type is [SanityCollectionItemsImages]...
0
votes
0
answers
24
views
Sanity GROQ Query Not Working in React Native App
I am building a react native project using react native expo and sanity cms. I have done the proper set up of sanity cms and also its schema. I have added the data in the localhost:333 server of ...
0
votes
0
answers
58
views
Next.js getStaticProps error in production. GraphQL Apollo client not rendering variable, instead getting error: Type error: No value exists in scope
My code seems to work in development but when I step away from the local environment, i get an error: Type error: No value exists in scope for the shorthand property 'currentTime'. Either declare one ...
0
votes
0
answers
46
views
Having asset issue invalid _type 'image' in Sanity, when trying to name it different
Mates.
I am stuck in a very serious problem and need guidance.
I created a schema
export default {
title: 'Blog Content',
name: 'blogContent',
type: 'object',
fields: [
{
title: 'Title',
...
0
votes
2
answers
529
views
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 ...
0
votes
0
answers
101
views
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 ...
0
votes
1
answer
249
views
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 ...
0
votes
1
answer
404
views
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 ...
0
votes
1
answer
129
views
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 ...
0
votes
1
answer
378
views
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 ...
0
votes
2
answers
3k
views
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 ...
0
votes
0
answers
823
views
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 ...
0
votes
1
answer
932
views
Can i merge/combine graphql API arrays into one?
Hey i'm using Sanity and have created both a allSanityPost (for my blog posts) and allSanityCases (for all my cases). Do anyone know how to combine these categories into one array and order them by ...
0
votes
0
answers
683
views
Internal Server Error - An internal server error occurred // SANITY // GATSBY
community - can anyone tell me, why i'm getting this error message every time i try to deploy my sanity graphQl? (See image and code snippet).
u: Internal Server Error - An internal server error ...
-1
votes
1
answer
762
views
How to remove GraphQL fields according to other fields, in Gatsby?
I have a page query that returns a video playlist. Some videos have 'public' set to true, some false. For the videos that have their public field set to false, I do not want to include the URL of that ...