想要备份一些技术文章和资料,很多博客都是php或要求数据库,找了一圈发现 Hugo 不错,单一文件,还是 golang 写的。
具体怎么使用搜索一下一大堆,这里写一下别的。
修改 Themes 后怎么编译
修改了别人的 scss 文件的话需要下载 extended 版本的hugo才能正常编译。只是修改HTML的话就不用。
显示行号、代码高亮
lineos
代表显示行号。
hl_line
代表代码里需要高亮的行,[2,3,5-7]
表示第2、3、5至7 行都高亮。
linenostart
表示行号从199开始,这里的行号跟高亮的行无关。
|
|
支持高亮的类型
- actionscript、actionscript3 actionscript, actionscript3, as, as3
- Angular2 ng2
- ApacheConf aconf, apache, apacheconf, conf, htaccess
- Bash bash, bash_*, bashrc, ebuild, eclass, exheres-0, exlib, ksh, sh, shell, zsh, zshrc
- Batchfile bat, batch, cmd, dosbatch, winbatch
- C c, h, idc
- C# c#, cs, csharp
- C++ C, CPP, H, c++, cc, cp, cpp, cxx, h++, hh, hpp, hxx
- CSS css
- Docker docker, dockerfile
- Go go, golang
- HTML htm, html, xhtml, xslt
- PHP inc, php, php3, php4, php5, php[345]
- PowerShell posh, powershell, ps1, psm1
- Python py, python, pyw, sage, sc, tac, py3, python3
- 其他 json, java, javascript, js, kotlin, lua, mysql, sql, objective-c, vue, vuewjs ,txt
Github Webhook
想要偷懒,在GitHub Push/Comment 后自动生成 Blog,以下是Golang的代码
-
main.go
监听3000端口,提供一个接口 /githubhook 。在GitHub新建一个 Webhooks 指向此处即可。
|
|
-
app.conf
获取最新的代码,然后调用 Hugo 生成站点,最后复制到网站的目录。2D:\Webapplication\Hugo\sites\blog 3git fetch 4git merge origin 5 6D:\Webapplication\Hugo\sites\blog 7D:\Webapplication\Hugo\sites\hugo.exe 8 9D:\Webapplication\Hugo\sites\blog 10xcopy D:\Webapplication\Hugo\sites\blog\public D:\Webapplication\Hugo\sites\public /e /k /y