Giter VIP home page Giter VIP logo

gatsby-source-craftcms's People

Contributors

dbrookes avatar gusnips avatar pr1ntr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pr1ntr

gatsby-source-craftcms's Issues

Support for entriesConnection?

Thank you for getting this working!

Is it possible to support entriesConnection style queries for relationships?

If I add one into the config, then nothing appears in the Gatsby schema, it looks like it could be because an entriesConnection query returns the data nested as data -> query -> edges instead.

What does the query option do?

I am trying to understand what this option does? Is there some explanation of what this is?
I was hoping that I could run queries directly on the craftql endpoint through gatsby-node.js as they will be dynamic in nature.

Cannot query field "categories" on type "Query".

I'm following along with the setup instructions.

I've installed Craft, and the CraftQL plugin successfully.

In gatsby-config.js I've added my endpoint and my token, and verified that the endpoint works by running a curl with '{"query":"{ helloWorld }"}. All good so far.

I've added in some content (including categories) into Craft and have been able to fetch them successfully using CraftQL's GraphiQL test tool (in the Craft CMS).

However when I run gatsby develop it fails with

error Plugin gatsby-source-craftcms returned an error

Error: Cannot query field "categories" on type "Query".: {"response":{"errors":[{"message":"Cannot query field \"categories\" on type \"Query\".","c  ategory":"graphql","locations":[{"line":2,"column":11}]}],"status":200},"request":{"query":"{\n          categories(site:\"default\",groupId:12) {\n                id\n              title\n              slug\n              uri\n          }\n      }"}}

I'm not sure what I'm doing wrong here. Is it a GraphQL syntax issue? I'm still quite new to GraphQL so could be missing something obvious. Any help would be great!

Querying Global Fields error

Hi

I am able to query entries and output the data to my templates, however Global fields are not available. Here is my code:

// gatsby-config.js
plugins: [
  {
		resolve: `gatsby-source-craftcms`,
		options: {
			endpoint: `http://cms.local/api`,
			token: `REDACTED`,
			query: `{
				globals: globals {
					contact {
						address
					}
				},
                home: entries(section:[home]) {
					id
					title
					... on Home {
						subHeading
						intro
						ctaButton {
							... on CtaButtonButton {
								__typename
								text
								linkUrl
							}
						}
					}
				},
// etc

And then in my template:

export const query = graphql`
  query {
    home {
		title
		subHeading
		intro
		ctaButton {
			text
			linkUrl
		}
	}
	globals {
		contact {
			address
		}
	}
  }
`

In my console I get:

error  Cannot query field "global" on type "Query"

If I remove the global from the query I can successfully build and output data.home.title.

I've tried using the CraftQL browser in the CMS and I can successfully query globals:

enter image description here

However, if i use GraphiQL browser IDE in Gatsby, I get this error: "message": "Cannot query field \"globals\" on type \"Query\".",

I'm confident I'm missing something but I can't find anything in the docs or in CraftQL.

Any idea what I'm doing wrong here??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.