Elementary usage of hugo, recorded when I build this blog.
install hugo
sudo apt install hugo
basic usage
Create new site
hugo new site xxxx
# hugo new site yoursite
Create new passage
hugo new type/name
# hugo new posts/name.md
Test
hugo -config config_path server
# -D means display draft
Generate website
hugo --config config_path
# config_path can be defined in config.toml
My config.toml
baseURL = "http://erwinliyh.github.io"
languageCode = "zh-Hans"
enableRobotsTXT = true
title = "LYH's Blog"
theme = "dream2.0b"
hasCJKLanguage = true
publishdir = "../publish"
#LavenderBlush
[params]
background = "#f2cac9"
backgroundImage = "/img/1.jpg"
linkColor = "seagreen"
# dark mode c48fa4
defaultDark = true
backgroundDark = "#b36d61"
backgroundImageDark = "/img/1.jpg"
darkLinkColor = "darkseagreen"
# darkNav = true
# dark404 = true
images = [""]
author = "Erwin"
description = "Li Yuanhao's Blog"
avatar = "/img/ichigo_square.jpg"
headerTitle = "Li Yuanhao's Blog"
motto = "python yyds"
# maxTags = 5
# categoriesLimitInHeader = 6 # deprecated
# headerBottomText = "" # deprecated
# footerBottomText = ""
#rss = true
utterancesRepo = "erwinLiYH/utterances_repo"
# valine = true
# LEANCLOUD_APP_ID = ""
# LEANCLOUD_APP_KEY = ""
# VALINE_LANGUAGE = ""
email = "erwinli@qq.com"
#twitter = ""
#facebook = ""
#instagram = ""
# mastodon = ""
#linkedin = ""
github = "ErwinLiYH"
#stackoverflow = ""
#codepen = ""
siteStartYear = 2020
favicon = "/favicon.ico"
highlightjs = true
highlightjsCDN = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"
highlightjsTheme = "github"
highlightjsThemeDark = "dracula"
# search
enableSearch = true
# options
showSummaryCoverInPost = true
# hasTwitterEmbed = true
# reversePostAndAside = true
# shareInAside = true
fixedNav = true
# collapsibleTags = true
# collapseBySummary = true
[params.advanced]
customCSS = ["css/background.css"]
# customJSBefore = []
# customJS = []
[params.experimental]
jsDate = true
jsDateFormat = "yyyy-MM-dd"
[outputs]
home = ["HTML", "RSS", "JSON"]