You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** This starter uses [Gatsby v4](https://www.gatsbyjs.com/blog/gatsby-v4/)with updated `gatsby-plugin-image`.
9
+
Gatsby Starter Henlo is the most advanced Netlify CMS starter for Gatsby.js. We built it with Page Builder setup in mind. All pages are created out of programmable blocks, aiming to provide the best DX & admin UX possible.
8
10
9
-
This repo contains an example business website that is built with [Gatsby](https://www.gatsbyjs.com/docs/), and [Netlify CMS](https://www.netlifycms.org).
11
+
This repo contains an example website that is built with [Gatsby](https://www.gatsbyjs.com/docs/), and [Netlify CMS](https://www.netlifycms.org).
10
12
11
13
It follows the [JAMstack architecture](https://jamstack.org) by using Git as a single source of truth, and [Netlify](https://www.netlify.com) for continuous deployment, and CDN distribution.
12
14
13
15
## Features
14
16
15
-
- Battle-tested starting point for small & large web projects
16
-
- Starter for pages and collections CMS configuration with Netlify CMS
17
-
- Easy Netlify CMS configuration using [Manual Initialization](https://www.netlifycms.org/docs/beta-features/#manual-initialization)
18
-
- Built in Tailwind with SCSS and `purge-css-plugin`
19
-
- Built in sitemaps
20
-
- Blazing fast loading times thanks to pre-rendered HTML and automatic chunk loading of JS files
21
-
- Uses `gatsby-plugin-image`
17
+
- 💪 Battle-tested starting point for small & large web projects
18
+
- 📄 Form Builder that enables Admins to create multiple forms with ease & Netlify Forms integration.
19
+
- 🌗 Darkmode support
20
+
- 🗺 Sitemaps using `gatsby-plugin-sitemap`
21
+
- 🔥 Perfect score on Lighthouse for SEO, Accessibility and Performance
22
+
- 💇♀️ TailwindCSS support with PostCSS processing & PurgeCSS
23
+
- 🔌 Support for Gatsby API functions
24
+
- 🎇 Crazy fast images with `gatsby-plugin-image`
25
+
- 🕵️♂️ Complete SEO configuration with graphql fragment and reusable components
22
26
- Netlify deploy configuration
23
-
- Netlify function support, see `lambda` folder
24
-
- Support for async Netlify forms
25
-
- Complete SEO configuration with graphql fragment and reusable components
26
-
- Perfect score on Lighthouse for SEO, Accessibility and Performance (wip:PWA)
27
+
- Example pages, collections, CMS configuration with Netlify CMS & hooks
27
28
- Readme template for custom projects
29
+
- Easy Netlify CMS configuration using [Manual Initialization](https://www.netlifycms.org/docs/beta-features/#manual-initialization)
28
30
- ..and more
29
31
30
32
## Prerequisites
@@ -35,7 +37,7 @@ It follows the [JAMstack architecture](https://jamstack.org) by using Git as a s
35
37
36
38
## Getting Started (Recommended)
37
39
38
-
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](https://github.com/netlify-templates/gatsby-starter-netlify-cms)). Use the button below to build and deploy your own copy of the repository:
40
+
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. Use the button below to build and deploy your own copy of the repository:
39
41
40
42
<ahref="https://app.netlify.com/start/deploy?repository=https://github.com/clean-commit/gatsby-starter-henlo"><imgsrc="https://www.netlify.com/img/deploy/button.svg"alt="Deploy to Netlify"></a>
41
43
@@ -56,19 +58,18 @@ Pulldown a local copy of the Github repository Netlify created for you, with the
This uses the new [Netlify Dev](https://www.netlify.com/products/dev/?utm_source=blog&utm_medium=netlifycms&utm_campaign=devex) CLI feature to serve any functions you have in the `lambda` folder.
64
-
65
-
To test the CMS locally, you'll need run a production build of the site:
64
+
To test the CMS locally, you'll need run a production build of the site & [run local instance of Netlify CMS](https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository)
66
65
67
66
```
68
-
$ yarn build
69
-
$ netlify dev # or ntl dev
67
+
$ yarn start
68
+
$ npx netlify-cms-proxy-server
70
69
```
71
70
71
+
Your admin configuration will be available at http://localhost:8000/admin
72
+
72
73
### Deployment
73
74
74
75
We've added additional commands for quick deployments with Netlify CLI. To deploy the website to netlify cms simply run.
@@ -79,93 +80,165 @@ $ yarn deploy:prod
79
80
80
81
The website will build locally and then deploy to production.
81
82
83
+
### Folder structure
84
+
85
+
```
86
+
├── cms # Netlify CMS configuration
87
+
│ ├── blocks
88
+
│ ├── collections
89
+
│ ├── fields
90
+
│ ├── previews
91
+
│ └── cms.js
92
+
├── content # Your content lives here
93
+
│ ├── authors
94
+
│ ├── blog
95
+
│ ├── forms
96
+
│ ├── pages
97
+
│ └── dont-remove.md
98
+
├── public
99
+
├── src
100
+
│ ├── api # Gatsby functions should be placed here
101
+
│ ├── blocks # Blocks that create sections
102
+
│ ├── components # Reusable components
103
+
│ ├── hooks # Hooks used in the project
104
+
│ ├── lib # misc
105
+
│ ├── pages
106
+
│ ├── resolvers
107
+
│ │ ├── Image.js # Required for previews
108
+
│ │ └── Link.js # Resolves links to gatsby and outside links
109
+
│ ├── settings # Place for theme settings
110
+
│ ├── styles
111
+
│ └── templates # Templates used to render page types
112
+
│ ├── page-builder.js
113
+
│ └── post.js
114
+
├── static
115
+
├── _headers
116
+
├── gatsby-config.js # Config files for gatsby
117
+
├── gatsby-node.js # Page generation setup
118
+
└── tailwind.config.js # Tailwind configuration
119
+
```
120
+
82
121
### Setting up the CMS
83
122
84
123
Follow the [Netlify CMS Quick Start Guide](https://www.netlifycms.org/docs/quick-start/#authentication) to set up authentication, and hosting.
85
124
125
+
CMS configuration was placed within `cms` directory in the root of the project. This allows us to work efficiently on fields and collections without mixing CMS config with Gatsby code.
126
+
86
127
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.
87
128
129
+
To ensure best experience we use 2 custom widgets that are maintained by us -> [ID Widget](https://github.com/clean-commit/netlify-cms-widget-id) that provides unmutable IDs for content items and [Permalink Widget](https://github.com/clean-commit/netlify-cms-widget-permalink) that enables you to create custom permalinks with ease.
Blocks are defined in `cms/blocks/index.js` file. We're leveraging use of exported functions and variables from other fields to avoid repetition within the code.
174
+
175
+
This is extremely important due to the way GraphQL works with Markdown based files. Each field will have to be present on all page queries -> we can't differetiate between different sections.
176
+
177
+
That's why it's important to reuse names of fields, hence usage of imports.
To add new block you have tp add new `Type` to `cms/blocks/index.js` file, and modify `Blocks` fragment located in `src/components/PageBuilder.js`
167
202
168
-
exportdefaultpage;
203
+
As you can see below we're adding all fields used by all sections. This causes issues with Gatsby's [Schema Inference](https://www.gatsbyjs.com/docs/schema-inference/). Gatsby needs an example of the field to know what type of field it is.
204
+
205
+
That's why we rely on `dont-remove.md` this file contains all possible fields used in the starter, so you're never encounter a problem with types inference!
206
+
207
+
```
208
+
exportconstquery= graphql`
209
+
fragment Blocks on MarkdownRemarkFrontmatter {
210
+
blocks {
211
+
type
212
+
title
213
+
content
214
+
columns {
215
+
title
216
+
content
217
+
}
218
+
photo {
219
+
image {
220
+
childImageSharp {
221
+
gatsbyImageData(
222
+
width: 800
223
+
quality: 72
224
+
placeholder: DOMINANT_COLOR
225
+
formats: [AUTO, WEBP, AVIF]
226
+
)
227
+
}
228
+
}
229
+
alt
230
+
}
231
+
variant
232
+
buttons {
233
+
button {
234
+
content
235
+
url
236
+
variant
237
+
}
238
+
}
239
+
}
240
+
}
241
+
`
169
242
```
170
243
171
244
### Adding Favicons
@@ -185,20 +258,6 @@ yarn preload-fonts
185
258
186
259
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](https://www.gatsbyjs.com/docs/how-to/custom-configuration/browser-support/)
187
260
188
-
## Debugging
189
-
190
-
Windows users might encounter `node-gyp` errors when trying to npm install.
191
-
To resolve, make sure that you have both Python 2.7 and the Visual C++ build environment installed.
MacOS users might also encounter some errors, for more info check [node-gyp](https://github.com/nodejs/node-gyp). We recommend using the latest stable node version.
201
-
202
261
## PurgeCSS
203
262
204
263
This plugin uses [gatsby-plugin-purgecss](https://www.gatsbyjs.org/packages/gatsby-plugin-purgecss/) and [Tailwind](https://tailwindcss.com/). The builds are usually ~780K but reduced 98% by purgecss. Normally our websites won't cross 30Kb of CSS.
0 commit comments