Hugo + Github + Netlify

自建博客站点:Hugo + Github + Netlify

What

建立一个技术博客,至少主要是记录技术相关的内容,方便我(或者任何人) Ctrl + C + Ctrl + V


Why

平时开发中,要用就搜,搜不到就问,会了就写,写完就丢。直到下次遇到相同的问题时,才猛然发觉——该是留个文档的,这该是CV工程师的觉悟,也是一个懒人的觉悟……

为什么是 Hugo

Hugo 是开源的、好看的、构建效率高的、Go语言写的。

为什么上 Github

方便迁移设备,Github 社区更好

为什么用 Netlify

  • 百度屏蔽了 Github
  • Netlify 有免费版本,简单,有CDN(速度快)

How

环境部署

安装 Git

安装 Hugo

前往 GitHub 搜索 “Hugo”,获取下载文件并安装。包含 “extended” 的版本属于拓展版,部分主题需要拓展版,请注意查看。

将 Hugo 所在文件夹添加到环境变量。

初始化项目

创建站点

1
hugo new site 站点名

添加主题

1
2
3
cd /站点名/themes

git clone https://github.com/CaiJimmy/hugo-theme-stack.git

配置

配置内容参考 \站点名\hugo-theme-stack\exampleSite\config.yaml

Hugo 常用命令

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 创建站点
hugo new site 站点名

# 新建文档
hugo new Test.md

# 新建主题
hugo new theme

# 查看版本
hugo version

部署 GithubPage

初始化本地仓库

1
2
3
4
5
6
7
8
# 初始化git仓库
git init

# 将当前路径下所有文件及子文件加入暂存区
git add .

# 提交
git commit -m "init repo"

创建 GitHub 仓库

推送数据

1
2
3
4
5
# 添加远程仓库
git remote add origin https://github.com/xxx.git

# 推送
git push origin

创建 GithubPage

Settings - Pages - Source

访问 https://xxx.github.io/xxx/#/ 即可看到 Github 上的站点。

部署Netlify

New site from Git - Github - 授权 - 选择仓库及分支 - 配置域名。

image-20220814184247086

访问 https://gearing.netlify.app/ 即可看到 Netlify 上的站点。

添加到百度搜索引擎

http://www.baidu.com/search/url_submit.html

image-20220814184111601


文献引用:

Releases · gohugoio/hugo (github.com)

GitHub

Netlify: Develop & deploy the best web experiences in record time

Licensed under CC BY-NC-SA 4.0
Comments
  • Latest
  • Oldest
  • Hottest
No comment yet.
Powered by Waline v2.15.8
Gear(夕照)的博客。记录开发、生活,以及一些不足为道的思考……