1、 安装Hugo
(1)二进制安装
到hugo的github上下载 https://github.com/gohugoio/hugo/releases
注:由于在github上下载太慢,百度云自取:(windows64位hugo压缩包) https://pan.baidu.com/s/1m_NVhDOOZo09974ugYdvcA 提取码: xqsm
2、 生成站点
hugo new site /path/to/site
这样就在 /path/to/site 目录里生成了初始站点,进去目录:
cd /path/to/site
3、 创建文章
hugo new about.md
about.md 自动生成导论content/about.md
4、 安装主题
在hugo官方文档挑选一款适合你的
然后:
cd themes
git clone xxxxx
5、配置
在你下载的主题文件里面,将exampleSite/theme.toml内容(有需求可自行修改下)复制到根目录下的config.toml中
6、 在本地运行hugo
hugo serve -t maupassant-hugo --buildDrafts//maupassant-hugo为你的theme名字
然后在浏览器输入http://localhost:1313
预览网站,按ctrl+c结束。
7、 部署到github上
(1)创建新库 名字格式为: 你的github用户名.github.io
注:名字格式必须这样,然后复制地址 如:https://github.com/defeat5839/defeat5839.github.io.git
(2) 部署
hugo --theme=maupassant-hugo --baseUrl="https://defeat5839.github.io/" --buildDrafts
hyde为你的主题名字,后面那个地址为上步骤复制的那个
(3)提交
cd public
git init
git add .
git commit -m "first"
git remote add origin https://github.com/defeat5839/defeat5839.github.io.git
git push//git push -u origin master