Coder Social home page Coder Social logo

allforabit / gatsby-starter-craftcms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from magicspon/gatsby-starter-craftcms

0.0 1.0 0.0 160 KB

Gatsby starter, craftcms, page transitions, rematch, tailwind, purge... offline, i could go on! - magicspon/gatsby-starter-craftcms

PHP 24.55% Batchfile 0.45% HTML 8.08% JavaScript 66.84% CSS 0.08%

gatsby-starter-craftcms's Introduction

Gatsby Starter Craftcms

Use Craftcms as a headless cms. Pull data into Gatsby via craftql that exposes the craft api as a grapql layer. Lovely stuff

Demo

wearestraightline

Features

Getting Started

Install craft Installation Instructions | Craft 3 Documentation

Install craftql GitHub - markhuot/craftql: A drop-in GraphQL server for Craft CMS

Once the helloWorld query works in craft, you’re in business

For the example code to work you’ll need to create a channel called blog, and add a few entries, they only need titles for now.

Gatsby

npm install

Open gatsby-config.js

You’ll need to add url for the craftql endpoint, and the bearer token:

{
	resolve: 'gatsby-source-graphql',
	options: {
		fieldName: 'craft',
		typeName: 'Craft',
		url: 'https://yourdomain/api',
		headers: {
			Authorization:
				'bearer XXXX'
		}
	}
},

npm start

You can now go to https://localhost:8000 and https://localhost:8000/___graphql

Go to the graphql explorer at https://localhost:8000/___graphql

Have a play. All of the Types are prefixed with Craft_

For example

{
	craft {
		entries(section: [blog]) {
			... on Craft_Blog {
				title
				uri
				postDate
			}
		}
	}
}

And that’s the weather…

Enjoy.

gatsby-starter-craftcms's People

Contributors

magicspon avatar

Watchers

James Cloos avatar

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.