目录

Hugo

Hugo 使用笔记

在gitee申请了pages服务,搭建了这个记录一些平时使用笔记的小地方,这篇文章记录在使用hugo中的一些东西。

常用命令

添加站点

hugo new site yoursite

添加theme,以我用的LoveIt为例

cd yoursite
git init
git submodule add https://github.com/dillonzq/LoveIt.git themes/LoveIt

当git clone下来的仓库中带有submodule时,submodule的内容并不会随着git clone一起下载下来,这个时候需要额外的执行如下命令获取submodule的内容:

git submodule init
git submodule update

如果submodule需要更新,进入submodule的目录下,git pull

基础配置

baseURL = "http://example.org/"
# 网站标题
title = "我的全新 Hugo 网站"
# 指定主题
theme = "LoveIt"

更多设置查看LoveIt主页

添加内容

使用hugo new添加内容,new还能提供更多的内容,如添加标题和日期

hugo new posts/hello-world.md

编辑内容

nvim /path/to/posts/hello-world.md

添加的内容默认已经有了一些东西如下:

---
title: "hello-world"
date: 2019-03-26T08:47:11+01:00
draft: true
---

需要需要发布,请将draft:true修改为draft:false,更多内容可以查看Draft的详细说明

启动hugo服务

hugo server

Build static pages

hugo -D