Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.
Hugo 是一个基于 Go 语言开发的静态网站生成器,主打简单、易用、高效、易扩展、快速部署,丰富的主题也使得 Hugo 也在个人博客站点搭建方面也使用广泛。之前自己的静态博客使用 Hexo 搭建,Hexo 是一个比较广泛使用的博客框架了,但总感觉速度有些慢,最近折腾着迁移到 Hugo,安装、构建、部署整个流程都感觉到了对比 Hexo 速度的提升🚀,简单记录一下。
1 安装
本地 macOS 平台直接使用 Homebrew 安装
1
brew install hugo
2 创建新站点
1
2
3
4
5
hugo new site blog
cd blog
hugo new posts/first-post.md
#!/bin/sh
# If a command fails then the deploy stopsset -e
printf"\033[0;32mDeploying updates to GitHub...\033[0m\n"# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`# Go To Public foldercd public
# Add changes to git.
git add .
# Commit changes.msg="rebuilding site $(date)"if[ -n "$*"];thenmsg="$*"fi
git commit -m "$msg"# Push source and build repos.
git push origin master