Gatsby starter site with Kentico Cloud.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add GH templates Oct 14, 2018
.vscode Disable unnecessary VS Code setting Oct 31, 2018
src Polish code Nov 18, 2018
.eslintrc.json Working v2 starter Oct 8, 2018
.gitignore Adapt to a breaking change Oct 14, 2018
CODE_OF_CONDUCT.md Add templates Sep 6, 2018
CONTRIBUTING.md Add templates Sep 6, 2018
LICENSE Initial commit Aug 17, 2018
README.md Merge branch 'master' into retrospective-improvements Jan 9, 2019
gatsby-config.js
gatsby-node.js Polish code Nov 18, 2018
package.json Fixes #31, #32 Dec 31, 2018

README.md

Gatsby starter site with Kentico Cloud

This repo contains a Gatsby v2 starter site preconfigured with Kentico Cloud source plugin. The site portrays a personal site of a fictional technical evangelist that attends user groups, writes blog posts and implements projects.

Gatsby starter site with Kentico Cloud

Prerequisites

How to run the code

The preferred way is to use Gatsby CLI gatsby new command, but you can of course simply clone or fork this repo.

Use Gatsby CLI

Make sure you have Gatsby CLI installed via npm list -g gatsby-cli. If not, you can install CLI via npm install --global gatsby-cli.

Then, navigate to your projects directory and run gatsby new [subdirectory name] https://github.com/Kentico/gatsby-starter-kentico-cloud. Replace [subdirctory name] with your project directory's name. The CLI tool will essentially do three things:

  • create a subdirectory
  • clone the starter site codefiles into that subdirectory
  • run npm install to get all dependencies for you

Clone or fork the repo

Clone or fork this repo. Once it's done, navigate to the app's root directory and run:

npm install

Run the starter site

Now, run:

npm run develop (or gatsby develop, should you have the Gatsby CLI installed)

This will bootstrap the site, build all static pages and start the site at http://localhost:8000 . You'll also be able to test arbitrary GraphQL queries in the GraphiQL interface via http://localhost:8000/___graphql.

Developing

You may use any IDE, however, we've added a settings file for Visual Studio Code for easier debugging.

To get a smooth debugging experience, you can temporarily copy the gatsby-source-kentico-cloud directory of the source plugin to the /plugins directory of your site. Then, move the gatsby-node.js and normalize.js files from /plugins/gatsby-source-kentico-cloud/src to /plugins/gatsby-source-kentico-cloud (up one level).

Using the Kentico Cloud JavaScript SDK configuration object

The source plugin used by this starter in turn uses the JavaScript SDK in the background. You can put the configuration object of the JS SDK into the deliveryClientConfig property of the gatsby-config.js file.

Experimenting

Of all the artifacts of Kentico Cloud, the starter site only displays content items and only in the default language. But, our source plugin also provides content types and items in non-default languages. The plugin links them all so that these data can be fetched in one GraphQL query.

Check out the source plugin for more details on which kinds of data and relationships it supports.

Analytics