contentauthoring.md
Welcome to the BGOONZ_BLOG_2.0 wiki!
How to install, setup and add new content to a Blog starter - front-end dev with Greg
Front-end web development with Greg is an educational project.
You install the starter like any other GatsbyJS starter - with the following GatsbyJS CLI command.
Of course you have to install the GatsbyJS CLI first, but I assume the PersonalBlog is not the first GatsbyJS starter you are installing so the CLI is already installed on your computer.
I do not recommend the PersonalBlog as your starting point with GatsbyJS. If you have no experience at all with GatsbyJS please go through the official Tutorials first.
After GatsbyJS CLI finishes installation you should be able to run gatsby develop
command. Run the command from the inside of the newly created directory.
You will see something more or less like this:
That means you can see the blog running in your web browser under the http://localhost:8000/
address.
Folders structure
This is the starter’s main folders structure.
Content
To easily customize all texts of the blog, not only posts, I extracted all content to its own separate folder.
The folder contains four subfolders.
Meta
There is a config.js
file inside the /content/meta/
folder.
Content of the config.js
file.
Edit values of the object’s properties according to your needs.
Posts
Every blog post has its own folder.
When you change or add new post, remeber to keep up with the post folder name pattern.
There are three obligatory parts:
a post date prefix
YYYY-MM-DD
,a separator
--
(two dashes)a slug
Only posts inside properly named folders are displayed on the blog post list.
Pages
The same way as posts, every page has its own folder.
When you change or add new page, remember to properly use the page folder name pattern.
There are three parts.
a page order number prefix
No
(one or more digit)a separator
--
(two dashes)a slug
Only pages inside folders with order prefix are displayed in the Info menu.
Parts
Through parts
you can edit content of elements which are parts of the blog’s layout, like an author note under a post or a footer.
Environment variables
The starter uses some external services:
Analytics by Google Analytics
Comments by Facebook Comments
Search by Algolia
To make them work you have to secure some access data. All services are free or have generous free tiers big enough for a personal blog.
Create a file in the root folder called .env
with content like below.
Change ...
to real strings. Do not use quote marks. Put data strings after the equal signs. Like in the example below.
You do not have to create .env
file just after the instalation. The gatsby develop
command should work without it. At least it works on my localhost environment. If you get an GraphQL Error
using gatsby develop
just after the installation, create the .env
file with the variables like above, even with empty string as the values.
For gatsby build
you absolutely need a real Algolia access data, without it the gatsby build
command will throw an error.
If you want to delay singing-up to Algolia you can temporarily turn off gatsby-plugin-algolia
. Open the gatsby-config.js
file in the root folder and comment or remove the gatsby-plugin-algolia
setup.
But hey, it’s not diffucult or long to setup your Algolia account for the starter.
Summary
That’s all for the first step. Now you should have a running blog with your own data running on your localhost. In the next post we will talk how to change the look of your blog. Stay tuned.
Last updated