introduction to Hugo

安装hugo #

通过系统包管理器或直接从github下载

创建站点及应用主题 #

hugo new site myblog
cd myblog
cd themes
git clone https://git.andy.sb/nojs.git

编辑hugo.toml,添加主题及菜单:

theme = "nojs"

[menus]
  [[menus.main]]
    name = 'Home'
    pageRef = '/'
    weight = 1

  [[menus.main]]
    name = 'Posts'
    pageRef = '/posts'
    weight = 2

  [[menus.main]]
    name = 'Tags'
    pageRef = '/tags'
    weight = 3

修改字体:

  1. 修改themes/nojs/assets/css/main.css,增加新字体名称:
    font-family: sans-serif;改为font-family: "LXGW WenKai Screen", sans-serif;
  2. 修改themes/nojs/layouts/_partials/head.html,增加样式:
    添加<link rel="stylesheet" href="https://npm.elemecdn.com/lxgw-wenkai-screen-webfont/style.css" />

Github Pages & Actions #

正常建立repo,点击Actions,搜索hugo,点击Configure直接保存。

新建页面 #

在根目录hugo new posts/new_post_title.md,即会在content/posts下新建new_post_title.md文件,再编辑内容即可。

其他 #

其他主题: yingyang.