This is write-up explaining how to setup a blog with Hugo, Markdown and github pages.
Hugo setup Link to heading
I am using Hugo which is an easy and fast static site generator. I use Markdown for content.
- Create a new Hugo site
hugo new site blog
- Install a theme Personally, I like this theme.
git submodule add https://github.com/rhazdon/hugo-theme-hello-friend-ng.git themes/hello-friend-ng/
Then configure the theme in config.toml
theme = "hello-friend-ng"
- Create first post
hugo new posts/my-first-post.md
hugo uses temple from archetypes/default.md
.
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
tags:
---
- Running Hugo For running a local server with latest changes (-D for drafts, -F for future posts)
hugo server -D -F
Just to build the output pages to be deployed
hugo
Github pages and actions Link to heading
Github offers a great service to host a repo on «user».github.io. And using github actions, you configured github pages to build every time i push into master
name: github pages
on:
push:
branches:
- master # Set a branch to deploy
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.68.3'
extended: true
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
Finally, You can always buy a domain name and configure DNS redirects to github pages. but no ain’t nobody have time for that.