Hublog随手记录一些东西

Hugo 部署

hugo FixIt 的初次部署过程

安装 hugo

Hugo Releases 下载对应的操作系统版本的Hugo二进制文件(hugo或者hugo.exe)

添加环境变量,在 path 中添加 hugo 的根目录

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 添加 hugo 项目
hugo new site site_name
# 创建文章
hugo new /posts/markdown.md
# 运行 hugo
hugo server 或 hugo serve
# 以指定主题运行 hugo,--theme=要运行的主题。(也可以在config文件中设置默认运行的主题)
hugo server --theme=FixIt --buildDrafts
# 由于 FixIt主题 使用了 Hugo 中的 .Scratch 来实现一些特性, 非常建议你为 hugo server 命令添加 --disableFastRender 参数来实时预览你正在编辑的文章页面。
hugo server --disableFastRender
# 生成静态文件,在public目录下
hugo

安装 FixIt 主题

在当前目录中初始化一个空的 Git 存储库。

FixIt 主题克隆到 themes 目录中,将其作为 Git 子模块 添加到您的项目中。

1
2
git init
git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt

之后,你可以在站点目录通过这条命令来将主题更新至最新版本:

1
git submodule update --remote --merge

Vercel 部署 hugo

将生成的 hugo 项目上传到 github 仓库

从仓库创建 app,成功之后修改 Vercel 的环境便量,指定当前的 hugo 版本

Vercel -> Project-> Settings -> Environment Variables HUGO_VERSION 0.110.0

0%