这个文档提供了用Hugo和Hugo的主题建设一个网站, 同步到Github, 并发布到Netlify的步骤.(以本网站010309为例,请注意替换010309为自己的网站名)
创建网站
从 Git Bash 运行这些命令以创建具有 [tailwind] 主题的 Hugo 站点。
hugo new site 010309
cd 010309
git init
git submodule add https://github.com/tomowang/hugo-theme-tailwind.git themes/tailwind
编辑配置
打开 Visual Studio Code,打开文件夹 \010309。 删除 hugo.toml。复制 \010309\themes\tailwind\config 到 \010309\config 并编辑其中的 hugo.toml。
baseURL = "https://010309.xyz/"
title = "010309: On January 3, 2009, Bitcoin officially came into existence when Satoshi Nakamoto mined the genesis block of Bitcoin (block number 0)."
author = "Ken"
copyright = "Ken"
paginate = 10
languageCode = "en"
defaultContentLanguage = "en"
enableInlineShortcodes = true
# prevent build failures when using Hugo's Instagram shortcode due to deprecated Instagram API.
# See https://github.com/gohugoio/hugo/issues/7228#issuecomment-714490456
ignoreErrors = ["error-remote-getjson"]
theme = "tailwind"
[markup]
_merge = "deep"
[taxonomies]
category = "categories"
tag = "tags"
series = "series"
[privacy]
[privacy.vimeo]
disabled = false
simple = true
[privacy.twitter]
disabled = false
enableDNT = true
simple = true
[privacy.instagram]
disabled = false
simple = true
[privacy.youtube]
disabled = false
privacyEnhanced = true
调试网站
点击新建终端,运行:
hugo server
在终端中显示的 URL 中查看您的站点(通常是http://localhost:1313/)。按“Ctrl + C”停止 Hugo 的开发服务器。
将代码推送到 Github
创建 Github 存储库010309。复制您的 SSH 路径(例如,我的路径是 git@github.com :Ken2626/010309.git)。运行:
git add .
git commit -m "First submit."
git branch -M main
git remote add origin git@github.com:Ken2626/010309.git
git push -u origin main
发布到 Netlify
按照此说明 [Host on Netlify](https://gohugo.io/hosting-and-deployment/hosting-on-netlify/) 操作