Starter of Calpa's Blog.
If you like my blog, please star it. Many thanks.
- Responsive Design
- Parse Markdown in high speed (powered by remarkable)
- Support to sitemap
- Font Awesome is auto loaded (powererd by react-fontawesome)
- Source from Contentful, a flexible and easy-to-use content management system
- Git
- Node: any 8.x version starting with 8.5.0 or greater
- A fork of the repo (for any contributions)
- A clone of the this repo on your local machine
How to start this project?
- Install Gatsby-CLI
npm install --global gatsby-cli
- Create new Gatsby project using this starter,
awesome-blog
is your blog's folder
gatsby new awesome-blog https://github.com/calpa/blog
- Open the folder
cd awesome-blog
-
Run Development Server
npm start
to start the hot-reloading development server (powered by Gatsby)open http://localhost:8000
to open the site in your favorite browser
-
Connect Contentful Server
- add the following config into
.env.development
file
API_SPACE_ID = Your Contentful Space ID API_TOKEN = Your Content Delivery (Preview) API - access token
If you are using contentful preview API, then all unpublished content will be available.
- add the following config into
Edit the export object in data/config
- Posts
To create a post, just provide the following object model:
{
"name": "Post",
"fields": {
"title": "Post Title",
"headerImgur": "header Image Link",
"headerBackgroundColor": "#66ccff",
"tags": "tag1, tag2, tag3",
"url": "awesome-post",
"createdDate": "new Date() or other dayjs supported datetime value",
"content": "your markdown content",
"jueJinLikeIconLink": "掘金 Badge Icon Url",
"jueJinPostLink": "掘金 Post Url"
}
}
- Headers
There are two configurable headers, Homepage and tags page.
{
"name": "Headers",
"fields": {
"purpose": "Tags or Home",
"headerImage": "header Image",
"createdDate": "new Date() or other dayjs supported datetime value",
"title": "Display Title",
"titleVisible": "Do you want to show your title in the header?",
"subTitle": "Display a smaller wordings",
"subTitleVisible": "Do you want to show a smaller wordings in the header?"
}
}
Calpa's blog is currently using Netlify, though, you may use Github Pages as an alternative.
-
Github Pages
npm run deploy
to deploy the blog to Github Pages -
Netlify
Auto Deploy
- Update the number of post pages automatically.
-
For
window is defined
, wrap the require in check for window:if (typeof window !== `undefined`) { const module = require("module"); }
-
npm run reset
to clear the local cache -
Check GatsbyJS Debugging Docs
If you are interested in this project, please feel free to contact Calpa Liu.
Thanks For Contribute... :)