Hugo 使用小结
文章目录
几个基本命令:
hugo # 编译,导出 html 静态网页至 publishDir
hugo --minify # 编译
hugo server # 在本地启动 hugo 服务
Archetypes
archetypes 这个文件夹存放的是内容模板,如果项目里没有任何文件,Hugo 会去主题文件里找。
hugo new posts/my-first-post.md以上命令会创建文件 content/posts/my-first-post.md,会依次寻找:
archetypes/posts.mdarchetypes/default.mdthemes/my-theme/archetypes/posts.mdthemes/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, i18n 和 archetypes 一个子项目

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论