Hugo使用笔记
Created 2021-08-28 / Updated 2022-05-16新建博客:
$ hugo new site 博客名
新建空白主题:
$ cd 博客名
hugo new theme 主题名
在config.toml
中添加以下内容以使用该主题:
theme = "主题名"
新建博客文章:
$ hugo new posts/xxx.md
新建about页面:
$ hugo new about.md
为使about页面和博客文章页面各自使用不同的模板,我是这样做的:
$ mkdir themes/主题名/layouts/misc
(该文件夹名可任意取,非一定要misc)
$ vi themes/主题名/layouts/misc/single.html
把about页面要使用的模板内容写在single.html
这个文件里。然后再在about.md的开头几行里加上:
type: misc
即可。
生成静态网页:
$ hugo
用rsync上传至服务器:
$ rsync -rlptDcvz --delete public/ user@ip:~/www
Categories: [www]