Ultimate guide to build your own blog
Build Your Hugo Blog Using GitHub and Netlify
Before you start
All hugo commands should be run in the root level
Build Hugo Blog Locally
Step 1: Install hugo && git
For Mac user:
|
|
Step 2: Create a new site
|
|
Step 3: Add a theme
You can find Hugo themes Here
In this case I use LoveIt theme as my example
|
|
Step 4: Basic Configuration
Copy config.toml content from example site to your config.toml
You can make your own changes in config.toml file
Step 5: Create your first post
|
|
In .md file, set:
|
|
Command above will generate a my-first-post.md file under the path: ./content/posts
You should always use hugo new posts/file.md to create new files
Step 6: Host the Website Locally
|
|
Go to http://localhost:1313
Step 7: Build the Website
Run:
|
|
After you run the hugo
command above, you will see content created under public
folder in your blog folder
Upload your code to GitHub
1. Create a new repo on GitHub
If you want to deploy on GitHub page:
Create a repo named your-github-username.github.io
For example:
My GitHub username is code-panda-x
My repo will be named code-panda-x.github.io
2. Git Initialiaztion
|
|
Whenever you make changes in your blog folder
Run :
|
|
Above code will update corresponding changes to public folder
Then run:
|
|
You can use git status to check your changes
|
|
Deploy on Netlify
Add netlify.toml
file to your blog:
|
|
- Sign in Netlify with GitHub account
- Add new site - Import an existing project
- Select your GitHub repo
- Your site will be pubished with a netlify domain
Customize Domain
- Purchase your domain at Godaddy.com or namecheap.com
- Netlify Configuration Domains - Custom domains - Add custom domain - Enter your purchased domain
DNS Management
Add:
- Type:
A
Name:@
Value:75.2.60.5
(Netlify’s load balancer IP address) - Type:
CNAME
Name:www
Value:your-url.netlify.app
Deploy on GitHub Page
Your site will be published on your-github-username.github.io
Customize Domain
- Purchase your domain at Godaddy.com or namecheap.com
- GitHub Page Configuration Settings - Code and automation - Custom domain - Enter your purchased domain
DNS Management
Add:
- Type:
A
Name:@
Value:185.199.108.153
- Type:
CNAME
Name:www
Value:your-github-username.github.io
Error Messages and Solutions
|
|
In config.toml:
Set enableGitInfo = true
|
|
In config.toml:
Set themesDir = "themes"