# 1. 准备:
- Mac电脑
- Git 工具
- GitHub 账号
# 2. 安装及初始化Git仓库
# 2.1 Mac安装hugo
|
|
# 2.2 创建一个站点
进入到放置站点的文件夹下,例如~/Blog
,然后运行下面的命令
|
|
# 2.3 初始化 git 仓库(可选)
在 TestBlog 目录下运行命令:
|
|
在根目录新增.gitignore
文件,内容如下
|
|
再提交到本地git仓库中
|
|
若需要提交到GitHub、GitLab等,请自行配置。
#
3. 添加 hugo-theme-stack
主题
# 3.1 拉取主题源码
在站点根目录下,即 TestBlog/
,通过git拉取主题源代码,放置位置在 TestBlog/themes/
目录下:
- 若执行了2.3初始化Git仓库的操作,就运行下面的命令获取主题
|
|
- git submodule add 的意思是作为一个子模块添加到当前Git仓库中。
- 若未执行 2.3初始化Git仓库的操作,就运行下面的命令获取主题
|
|
# 3.2修改配置文件
在站点根目录下操作
|
|
然后暂时修改languageCode
、theme
、DefaultContentLanguage
这三个配置,内容如下:
|
|
# 3.3 修改内容区
在站点根目录下操作
|
|
# 4. 运行
在站点根目录下执行:
|
|
参考文章