如何快速搭建静态博客

安装hugo

install hugo  
hugo version  
hugo new site blog-demo  

下载主题

cd blog-demo  
git clone  git@github.com:colorchestra/smol.git themes/smol  
cd themes/smol  
rm -rf .git  

配置

hugo.toml

baseURL = 'https://spoofer0.github.io/'
languageCode = 'zh-cn' #en-us
defaultContentLanguage = 'zh-cn'
theme = "hyde"

title = '不满是向上的车轮'

paginate = 10
ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]

[author]
  name = "spoofer0"

# Menu config
# 菜单配置
[menu]

  [[menu.main]]
    weight = 1
    identifier = "posts"  
    pre = ""     
    post = ""
    name = "Posts"
    url = "/posts/"  
    title = ""

  [[menu.main]]
    weight = 2
    identifier = "tags"
    pre = ""
    post = ""
    name = "Tags"
    url = "/tags/"
    title = ""

[params]
  themeColor = "theme-base-0f"
  layoutReverse = true
  Description = "can can need"

[Permalinks]
  #posts = ":year/:month/:filename"
  posts = ":filename"

本地调试预览

hugo server
hugo server --theme=hyde  --buildDrafts --watch  

发布文章

hugo new posts/blog-test.md  
hugo new content  --kind  posts/blog-test.md  

生成PUBLIC发布文件夹

hugo

发布配置

CNAME  
hugo.toml->baseURL 改为自己的自定义域名。  

手动发布

将 public/ 目录初始化为 git 仓库并关联远程仓库(spo0fer.github.io)来推送网页静态文件。  
hugo   #生产静态文件到public  
cd public  
git init  
git remote add origin git@github.com:spoofer0/spoofer0.github.io  
git add .  
git commit -m  "debug"  
git push origin main