Note: This starter uses Gatsby v3 with updated gatsby-plugin-image
.
This repo contains an example business website that is built with Gatsby, and Netlify CMS.
It follows the JAMstack architecture by using Git as a single source of truth, and Netlify for continuous deployment, and CDN distribution.
- Battle-tested starting point for small & large web projects
- Starter for pages and collections CMS configuration with Netlify CMS
- Easy Netlify CMS configuration using Manual Initialization
- Built in Tailwind with SCSS and
purge-css-plugin
- Built in sitemaps
- Blazing fast loading times thanks to pre-rendered HTML and automatic chunk loading of JS files
- Uses
gatsby-plugin-image
- Netlify deploy configuration
- Netlify function support, see
lambda
folder - Support for async Netlify forms
- Complete SEO configuration with graphql fragment and reusable components
- Perfect score on Lighthouse for SEO, Accessibility and Performance (wip:PWA)
- Readme template for custom projects
- ..and more
- Node 14.15.5
- Gatsby CLI
- Netlify CLI
Netlify CMS 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. The example here is the Kaldi coffee company template (adapted from Gatsby Starter Netlify CMS). 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.
$ gatsby new [SITE_DIRECTORY_NAME] https://github.com/clean-commit/gatsby-starter-henlo
$ cd [SITE_DIRECTORY_NAME]
$ yarn start
Pulldown a local copy of the Github repository Netlify created for you, with the name you specified in the previous step
$ git clone https://github.com/[GITHUB_USERNAME]/[REPO_NAME].git
$ cd [REPO_NAME]
$ yarn
$ netlify dev
This uses the new Netlify Dev CLI feature to serve any functions you have in the lambda
folder.
To test the CMS locally, you'll need run a production build of the site:
$ yarn build
$ netlify dev # or ntl dev
We've added additional commands for quick deployments with Netlify CLI. To deploy the website to netlify cms simply run.
$ yarn deploy:prod
The website will build locally and then deploy to production.
Follow the Netlify CMS Quick Start Guide to set up authentication, and hosting.
Henlo uses Manual Initialization to take advantage of componetized approach to managing configuration for Netlify CMS. Thanks to that you don't have to control the CMS from centralized YAML file.
import CMS from 'netlify-cms-app'
import pages from '@/cms/pages'
import posts from '@/cms/collections/posts'
window.CMS_MANUAL_INIT = true
CMS.init({
config: {
load_config_file: false,
backend: {
name: 'git-gateway',
branch: 'master',
},
media_folder: '/static/img',
public_folder: '/img',
collections: [pages, posts],
},
})
import seo from '@/cms/partials/seo'
const page = {
file: 'content/pages/home.md',
label: 'Home',
name: 'Home',
fields: [
{
label: 'Layout',
name: 'layout',
widget: 'hidden',
default: 'index',
},
{
label: 'Type',
name: 'type',
widget: 'hidden',
default: 'page',
},
{
label: 'Title',
name: 'title',
widget: 'string',
default: '',
required: false,
},
{
label: 'Links',
name: 'links',
widget: 'list',
fields: [
{
label: 'Link',
name: 'link',
widget: 'object',
fields: [
{
label: 'Content',
name: 'content',
widget: 'string',
required: false,
},
{
label: 'URL',
name: 'url',
widget: 'string',
required: false,
},
],
},
],
},
seo,
],
}
export default page
Favicons can be generated using this Favicon Generator After generating the icons, drop the contents of downloaded file into static/img/favicons
directory
Since 0.4.0 Henlo supports gatsby-plugin-preload-fonts
plugin out of the box. To create the preload cache you need to start development server and then run preload-fonts
command. This will generate the font-preload-cache.json
file in the root of your project. When your projects builds fonts will be added automatically to head of the document.
yarn start
yarn preload-fonts
Gatsby tends to add a lot of polyfills to support older browser versions. In package.json file you can adjust which sites your project should support. As default Henlo will use defaults
setting. If you want to learn more about the browser support visit official Gatsby How-To Guide on this subject
Windows users might encounter node-gyp
errors when trying to npm install.
To resolve, make sure that you have both Python 2.7 and the Visual C++ build environment installed.
npm config set python python2.7
npm install --global --production windows-build-tools
MacOS users might also encounter some errors, for more info check node-gyp. We recommend using the latest stable node version.
This plugin uses gatsby-plugin-purgecss and Tailwind. The builds are usually ~780K but reduced 98% by purgecss. Normally our websites won't cross 30Kb of CSS.
Since Henlo v0.5.0 we use PurgeCSS v4, the default configuration is already included, to learn more check purgecss docs or check gatsby-plugin-purgecss documentation
{
resolve: `gatsby-plugin-purgecss`,
options: {
printRejected: true,
develop: false,
tailwind: true,
purgeCSSOptions: {
safelist: {
standard: [],
deep: [],
},
},
},
},
Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct.
Here's a list of helpful articles that will help you with your first steps using Henlo!