termux安装hugo
新建网站
主题配置
- 进入网站根目录
2.下载子模主题
1
| git submodule init https://github.com/olOwOlo/hugo-theme-even themes/even
|
- 配置主题请参考官方主题设置
重要: 在主题的 exampleSite 目录下有一个 config.toml 文件,将这个 config.toml 文件复制到你的站点目录下,根据自己的需求更改即可。
1
| cp themes/even/exampleSite/config.toml ~
|
注意: 对于这个主题,你应该使用 post 而不是 posts,即 hugo new post/some-content.md。
- 启动本地服务器
netlify配置文件
要部署到netlify,必须建一个netlify配置文件,可以参考
https://gohugo.io/hosting-and-deployment/hosting-on-netlify/
- 在网站根目录
输入如下内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| [build]
publish = "public"
command = "hugo --gc --minify"
[context.production.environment]
HUGO_VERSION = "0.55.6"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
[context.split1]
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.55.6"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.55.6"
[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.55.6"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"
|
上传源代码
- 进入博客目录
- 创建版本库
在github或者gitee新建一个仓库blog
生成ssh密匙
如果已经设置ssh密钥,直接跳到下一步
1
| ssh-keygen -t rsa -C "你github登录邮箱"
|
直接回车3次生成成功
复制内容添加到github ssh密匙中。
- 连接到远程库
1
| git remote add origin https://gitee.com/xxx/blog.git
|
- 添加全部博客文件
- 注释
- 第一次部署强制上传到服务器
1
| git push -u origin master
|
- 以后在更新直接更新
1
2
|
git push origin master
|
部署网站到netlify
- 进入netlify网站点击github如下图

- 选择上面github仓库,配置成功后自动生成网站。
- 修改netlify域名及解析自己的域名并开启https
netlify自动生成的域名不方便记忆,修改后netlify的域名是https://www.****.netlify.com
所有的配置都在setting下面
