At the beginning of 2021, I created a project called Rave of Phonetics, and you can know how I had the idea through the blog post public and useful tool to understand phonetics. With all the lessons learned I gathered from it, I thought it was time to create my very blog from scratch to discover even more things. That's how it came to life! Curiosity as always 👀
I think this couldn't have been possible without the following projects:
Hence here's my thanks! I am thankful for people that share stuff with the community 🤓
Just issue the command docker-compose up
. It will build the image and run it for you afterwards. If you have an OAuth Provider configured on Netlify, you can even access the admin page. Accessible links:
- Home: http://localhost:9000/
- RSS: http://localhost:9000/rss.xml
- Sitemap: http://localhost:9000/sitemap.xml
- CMS: http://localhost:9000/genie
If you'd like to run it without docker, first install the packages:
npm install
Then you can just issue npm run develop
, but let's say that you want to build it, for that execute the following:
GOOGLE_TAG_MANAGER_ID=YOUR_GTM_ID \
SITE_URL=http://localhost:9000/ \
NETLIFY_CMS_BACKEND_REPO=YOUR_REPO \
NETLIFY_CMS_BACKEND_BRANCH=YOUR_BRANCH \
npm run build
Now you can serve it through gatsby (not recommended for production, just as a means to evaluate what was built):
GOOGLE_TAG_MANAGER_ID=YOUR_GTM_ID \
SITE_URL=http://localhost:9000/ \
NETLIFY_CMS_BACKEND_REPO=YOUR_REPO \
NETLIFY_CMS_BACKEND_BRANCH=YOUR_BRANCH \
npm run serve
Sadly, even when serving the generated static files, gatsby reads gatsby-config.js
, that's why you need to set the environment variables.
You need to run npm run cms
and npm run develop
, then you can use the CMS locally without the need of doing OAuth flow.
First access the container:
docker-compose run blog bash
Then you can issue ls -l public
! gatsby-plugin-netlify
generates _headers
file for Netlify Platform. You can consult it issuing cat public/_headers
.
That is quite simple. Just follow the bullets:
- You need to change
siteMetadata
const with you own data (see the file gatsby-config.js). - To run locally properly, update .env.development as well.
- Delete the content of content/blog folder and create your own very post.
That's it!