Hugo 使用小结

Archetypes

archetypes 这个文件夹存放的是内容模板,如果项目里没有任何文件,Hugo 会去主题文件里找。

hugo new posts/my-first-post.md

以上命令会创建文件 content/posts/my-first-post.md,会依次寻找:

  1. archetypes/posts.md
  2. archetypes/default.md
  3. themes/my-theme/archetypes/posts.md
  4. themes/my-theme/archetypes/default.md

my-theme 是使用的主题。

模板示例:

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

Content

所有文章的内容都存放在 content 目录下。

Hugo Modules

Hugo 的模块可以是一个主项目,也可以是包含 static, content, layouts, data, assets, i18narchetypes 一个子项目

你可能感兴趣的:(hugo)