Lumen is a minimal, lightweight and mobile-first starter for creating blogs using Gatsby.
This is an edited clone of gatsby-starter-lumen and gatsby-v2-starter-lumen migrated for getting content from headless CMS Kontent.
Go to app.kontent.ai and create empty project
Go to "Project Settings", select API keys and copy
Install Kontent Backup Manager and import data to newly created project from kontent-backup.zip
file (place appropriate values for apiKey
and projectId
arguments):
npm i -g @kentico/kontent-backup-manager
kbm --action=restore --apiKey=<Management API key> --projectId=<Project ID> --zipFilename=kontent-backup
Alternatively, you can use the Template Manager UI for importing the content.
Go to your Kontent project and publish all the imported items.
Copy .env.template
and name it .env
then set the KONTENT_PROJECT_ID
environment variable to value from Kontent -> "Project Settings" -> API keys -> Project ID.
This step could be done automatically by running
npm run prepare-environment
command defined inpackage.json
.
You are now ready to use the site as your own!
Install the dependencies and run development environment
npm install
npm run prepare-environment # Creates a .env file from .env.template file if no .env file exists
npm run develop
Install the dependencies and run production build
npm install
npm run prepare-environment # Creates a .env file from .env.template file if no .env file exists
npm run build
To allow this example load unpublished content via Preview Delivery API, you just need to adjust .env
file created in "Join codebase to content data" section by setting these environment variables:
<PREVIEW_API_KEY>
by passing the Preview authentication keytrue
You could also walk through the Getting started with Gatsby Cloud and Kontent to set up your Preview environment on Gatsby Cloud plus enjoy the bonus in form of incremental builds.
If you are more fan of Netlify, you could follow Deploy to Netlify section and then provide the Environment variables mentioned above in Netlify.
Once you've got your app running in a preview environment, you need to specify where (URL-wise) each type of your content can be accessed and viewed. For example, imagine your app runs at https://preview.example.com so you want to open "Project Settings", and select "Preview URLs" set it like this:
Article
: https://preview.example.com/articles/{URLslug}
Author
: https://preview.example.com
Category
: https://preview.example.com/categories/{URLslug}
Menu
: https://preview.example.com
Menu Item
: https://preview.example.com/{URLslug}
Tag
: https://preview.example.com/tags/{URLslug}
If you are using more complex and nested menu navigation, use example of the Gatsby Navigation example. In a nutshell, you want to register routes endpoint i.e.
/preview/<LANGUAGE>/<CODENAME>
to the same page as was registered fornormal
URL.
Before deploying to production add own google analytics trackingId
to [gatsby-config.js
].
Netlify can run in any frontend web environment, but the quickest way to try it out is by running it on a pre-configured starter site with Netlify. Use the button below to build and deploy your own copy of the repository:
After clicking that button, you’ll authenticate with GitHub and choose a repository name. Netlify will then automatically create a repository in your GitHub account with a copy of the files from the template. Next, it will build and deploy the new site on Netlify, bringing you to the site dashboard when the build is complete. Next, you’ll need to set up Netlify’s Identity service to authorize users to log in to the CMS.
If you want to use Incremental builds, you need to enable Build Plugins Beta for your site.
If you want to deploy your own copy of the gatsby-lumen-starter project, in the netlify.toml file modify the
KONTENT_PROJECT_ID
environment variable to match the value from your Kontent project's "Project Settings" -> API keys -> Project ID, or set the Netlify environment variables through the Netlify UI.
└── src
├── assets
│ ├── fonts
│ │ └── fontello-771c82e0
│ │ ├── css
│ │ └── font
│ └── scss
│ ├── base
│ ├── mixins
│ └── pages
├── components
│ ├── Article
│ ├── ArticleTemplateDetails
│ ├── CategoryTemplateDetails
│ ├── Links
│ ├── Layout
│ ├── Menu
│ ├── PageTemplateDetails
│ ├── Sidebar
│ └── TagTemplateDetails
├── pages
└── templates
This example is ready to be used with Web Spotlight functionality. If you want to explore the possibilities, take a look to the Web Spotlight tutorial!