如何用GitHub Pages + hugo搭建个人博客Page Cover
如何用GitHub Pages + hugo搭建个人博客
October 4th 20232 min read302 wordsUpdated March 31st 2025

博客已经迁移到 nextjs + cloudflare Pages

GitHub Pages + Hugo 请参考这篇文章


使用Makefile实现自动发布Hugo博客

在 bolg 仓库下新建一个 Makefile 文件,拷贝下面的代码进去,每次写完在 blog 仓库下执行 make 即可

MSG := "BLOG_TIME:" MSG += $(shell date) all: @hugo && \ if git add --all && git commit -m "$(MSG)"; then \ git push && echo "\033[32mBlog Repo Success!\033[0m";\ else \ echo "\033[31mNothing need commit in Blog Repo\033[0m"; \ fi @cd ./public/ && \ if git add --all && git commit -m "$(MSG)"; then \ git push && echo "\033[32mPublic Repo Success!\033[0m"; \ else \ echo "\033[31mNothing need commit in Public Repo\033[0m"; \ fi .PHONY: all

代码实现

定义一个MSG变量,从Shell中获取当天日期添加到MSG作为commit; 然后执行hugo,生成 public 文件,接着判断 Blog 和 public 仓库之下有没有需要添加的更改, 如果有就 add 、commit、然后推送到 remote,如果没有则停止

其他

  1. hugo基本用法
  2. firebase部署,可以提供一些交互性功能
  3. 配色参考,中国风配色网站
  4. 博客主题Blowfish适配移动端
  5. Godaddy域名绑定以及配置DNS
  6. 生成不同分辨率的网站图标

end