目录

Github+Netlify+Coding+Hugo搭建blog

静态站双线配置

参考:

https://zhuanlan.zhihu.com/p/133837149

https://linsage.com/posts/hugo-coding-netlify/

GitHub+Netlify

Github

创建项目example.github.io/hugo-blog

Netlify

  1. 官方地址:https://app.netlify.com/
  2. 使用GitHub登录
  3. 点击 New site from Git
  4. 选择select project
  5. 选择分支master、打包命令(这里为空)、打包后路径(这里为空)
  6. Deploy Site
  7. 可设置自定义域名,这里为https://example.netlify.app/,需将域名解析(cname,选择境外)至该域名。
  8. 配置https

配置参考:https://www.cnblogs.com/linx/p/11060215.html

Coding Project

创建项目example/hugo-blog

  1. 域名解析至coding静态站路径,同样是cname地址

Hugo Blog

Hugo配置

1
2
3
4
5
6
7
8
9
git clone git@e.coding.net:example/example/hugo-blog.git
编辑.git/config
将
[remote "origin"]
        url = git@e.coding.net:example/example/hugo-blog.git
改为
[remote "origin"]
        url = git@e.coding.net:example/example/hugo-blog.git
        url = git@github.com:example/hugo-blog.git

静态站配置

1
2
3
4
5
6
7
8
9
git clone git@e.coding.net:example/example/example.git
编辑.git/config
将
[remote "origin"]
        url = git@e.coding.net:example/example/example.git
改为
[remote "origin"]
        url = git@e.coding.net:example/example/example.git
        url = git@github.com:example/example.github.io.git

Hugo ENV

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cd hugo-blog
go mod init
go get -v  github.com/gohugoio/hugo
hugo new site . --force
hugo new about.md #创建一个about页面
hugo new post/first.md #创建一篇文
cd themes
git clone https://github.com/dillonzq/LoveIt.git LoveIt
git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c
hugo server --theme=m10c --buildDrafts --bind="0.0.0.0" #运行
hugo --theme=hyde --baseUrl="http://blog.mulinux.com/" #生成静态文件到public