Build Hugo Github

Publish date: 2019-05-27

Build a github.io website by Hugo and Deployed to Netlify.

Hugo Local setup

hugo new site lgann-website
cd lgann-website
git init
git submodule add  https://github.com/zwbetz-gh/cayman-hugo-theme themes/cayman
hugo new post/first.md
hugo new posts/build-hugo-github.md

config.toml

baseURL = "https://lgann.github.io/"
languageCode = "zh-CN"
#languageCode = "en-us"
title = "LGANN's Blog Website"
theme = "cayman"
defaultContentLanguage =      "zh-CN"
hasCJKLanguage =             true 

# Google analytics
# OBgoogleAnalytics = "UA-123456789-1"

# Disqus comments
#disqusShortname = "yourdiscussshortname"

# Syntax highlighting
pygmentsCodefences = true
pygmentsStyle = "pygments"

[taxonomies]
  tag = "tags"

[permalinks]
  post = "/:filename/"

[params]

  author = "Louis Gan"
  github = "lgann"

  # Header text, can be markdown
  project_name = "LGANN Blog"
  project_tagline = "New Start"

  # Date format for post list and single pages
  # For more date formats see https://gohugo.io/functions/format/
  dateFormat = "2006-01-02"

  # Footer text, can be markdown
  footer = "Made with [Hugo](https://gohugo.io/). Themed by [Cayman](https://github.com/zwbetz-gh/cayman-hugo-theme). Deployed to [Netlify](https://www.netlify.com/)."

  # If true, the CSS/JS for Katex math typesetting are enabled
  katex = true

  # Breakpoints
  large_breakpoint = "64em"
  medium_breakpoint = "42em"

  # Header colors
  header_heading_color = "#fff"
  header_background_color = "#159957"
  header_background_color_secondary = "#155799"

  # Text colors
  section_headings_color = "#159957"
  body_text_color = "#606c71"
  body_link_color = "#1e6bb8"
  blockquote_text_color = "#819198"

  # Code colors
  code_background_color = "#f3f6fa"
  code_text_color = "#567482"

  # Border colors
  border_color = "#dce6f0"
  table_border_color = "#e9ebec"
  hr_border_color = "#eff0f1"

[menu]
  [[menu.nav]]
    name = "Blog"
    url = "/"
    weight = 1
  [[menu.nav]]
    name = "Tags"
    url = "/tags/"
    weight = 2
  [[menu.nav]]
    name = "About"
    url = "/about/"
    weight = 3
  [[menu.nav]]
    name = "RSS"
    url = "/index.xml"
    weight = 4

hugo server -D
#visit http://http://localhost:1313 to test the website

Deployed to GIthub

create lgann-website-hugo repo at github

create lgann.github.io repo at githu

hugo
cd public
git init
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_lgann -F /dev/null"
git remote add origin git@github.com:lgann/lgann.github.io.git
git add .
git commit -m "Initial commit"
git push -u origin master
pwd
/c/dev/lgann-website
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_lgann -F /dev/null"
git remote add origin git@github.com:lgann/lgann-website-hugo.git
git add .
git commit -m "Initial commit"
git push -u origin master

Deployed To netlify

Reference

在 GitHub 部署 Hugo 靜態網站

Hugo 从入门到会用

A Step-by-Step Guide: Victor-Hugo on Netlify