Hugo

Theme Doc - hextra

Theme-hextra

# an easy way?
hugo serve -D -t theme_name_here
# Change directory to the theme folder
cd hextra-starter-template

# Start the server
hugo mod tidy
hugo server --logLevel debug --disableFastRender -p 1313

# Update the theme
hugo mod get -u
hugo mod tidy
# start the server for draft
hugo server -D

Installing on mac

brew install hogo

Creating

hugo new site first_site

Installing & using themes

# within config.toml
theme = "the name of theme downloaded"

content

hugo new a.md

List pages: if the folder is not the first folder level under content

# it must to be _index.md here
hugo new dir1/dir2/_index.md

archetypes

  1. find if there exist the folder name within archetypes that correspond with the folder name within content
  2. yes: use the specific markdown file; no: use the default.md

Shortcodes

# /{/{/< shortcode-name param1 />/}/}
# e.g.
# /{/{/< youtube AnyYoutubeID />/}/}

Tags & Categories

tags: ["tag1", "tag2", "tag3"]
categories: ["cat1"]

Creating taxonomy

  • Notice: modify themes/ga-hugo-theme/layouts/_default/list.html by adding a new line for that name mood
mood: ["happy", "upset"]
# hugo.toml
# even if tag and category are default, but we have to include them when we creating new taxonomies
# after modifyint he toml file, restart the server
[taxonomies]
  tag = "tags"
  category = "categories"
  mood = "moods" 

Setting up Github Page

Cretea production repository

  1. the repository’s name has to be username.github.io
  2. it at least has one commit
git clone [email protected]:yixianwang/yixianwang.github.io.git
cd yixianwang.github.io
git checkout -b main
touch README.md
git status
git add .
git commit -m "adding readme"
git push origin main

Add submodule

  1. Head to yixian-site folder
git submodule add -b main [email protected]:yixianwang/yixianwang.github.io.git public

Deploy the site

Generate public folder with static website

hugo # without draft
hugo -D # with draft
# or
# hugo -t theme_name

Push

  1. Head to public folder
git add .
git commit -m "update"
git push origin main