hugo
Hugo是一个用 Go语言 编写的静态网站生成器,可以快速地生成高效、安全和易于管理的静态网站。Hugo具有速度快、可定制性强、易于使用等特点,被广泛应用于个人博客、公司网站、文档站点等领域。
Hugo支持Markdown、HTML、CSS、JavaScript等标准文件格式,并提供了多种主题、插件、模板等功能,使用户能够轻松地创建独特而具有吸引力的网站。同时,Hugo还支持多种语言和主流平台,满足不同用户的需求。
安装快速指引
wget https://github.com/gohugoio/hugo/releases/download/v0.111.3/hugo_0.111.3_Linux-64bit.tar.gz
tar xvf hugo_0.111.3_Linux-64bit.tar.gz
cp hugo /usr/local/bin
hugo version
例如:qingconglaixueit.github.io
"账户名.github.io
"
本次是使用 linux 的环境,可以在自己的任意目录下,创建自己的站点
hugo new site abing_blog
# 例如当前已经在 abing_blog 下
cd themes
git clone git@github.com:alanorth/hugo-theme-bootstrap4-blog.git bootstrap4
cd ..
cp themes/bootstrap4/exampleSite/config.toml
cp themes/bootstrap4/content/post/* content/post/
vim config.toml
hugo --theme=bootstrap4 --baseUrl="https://qingconglaixueit.github.io/"'
# 初始化仓库 , 如下需要换成自己的 xxx.github.io
git init
# 将所有内容添加到git
git add .
# 提交到git 本地
git commit -m "commit msg"
# 关联到远程git,注意这里需要写你自己的git 地址
git remote add origin https://github.com/qingconglaixueit/qingconglaixueit.github.io.git
# 推送到远程git
git push origin main
# 执行如下命令后,会在 博客 根目录下的 content/post 下生成具体的 md 文件,记得吧 md 中的 draft 设置为 false
hugo new post/xxx.md
# 编辑这个 md 成自己想要的内容
# 回到博客根目录下,渲染静态文件
hugo --theme=bootstrap4 --baseUrl="https://qingconglaixueit.github.io/"'
# 此时 到 public 目录下提交代码即可
可以查看地址:https://qingconglaixueit.github.io/ 看看效果
再细节一点的以及 hugo 详细命令等内容可以查看 hugo 中文文档 安装快速指引
# 进入博客站点
alias inblog='cd /home/xmt/abing_blog/'
# 添加文章
alias addblog='_addblog(){ inblog; hugo new post/"$1";vim content/post/"$1";};_addblog'
# 渲染静态资源
alias hugoup='inblog; hugo --theme=bootstrap4 --baseUrl="https://qingconglaixueit.github.io/"'
# 提交 code
alias blogcmpush='inblog; cd public/ ;git add .;git commit -m "update article" ;git push ; cd ../ '
# 渲染并提交 code
alias hb='hugoup;blogcmpush'