Hugo定制网站
安装Hugo
- 先安装Hugo
brew install hugo
- 创建新的网站
hugo new site you_website_name
- 选择Theme并添加
cd you_website_name
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
把theme的名字配置到config.toml中:
echo theme = \"ananke\" >> config.toml
- 创建内容
hugo new posts/my-first-post.md
- 运行server
hugo server -D
在浏览器中打开http://localhost:1313/查看预览的效果。
定制主题
生成网站
hugo -D
生成的网站都放在public目录中
部署到Web server
- 把public目录上传到web server中,并修改
/etc/nginx/sites-available/default
,把网站的root
目录指向网站的目录,并修改首页为index.html
- 重启nginx的server
sudo systemctl reload nginx
sudo service nginx restart
- 打开浏览器,检查是否正确。