首页
/ Hermit 项目教程

Hermit 项目教程

2024-09-15 07:18:23作者:袁立春Spencer

1. 项目的目录结构及介绍

Hermit 项目的目录结构如下:

hermit/
├── bin/
│   └── hermit
├── config/
│   ├── hermit.toml
│   └── themes/
├── content/
│   ├── _index.md
│   └── posts/
├── static/
├── templates/
│   ├── base.html
│   └── post.html
├── themes/
│   └── default/
├── .gitignore
├── LICENSE
├── README.md
└── hermit.go

目录结构介绍

  • bin/: 存放可执行文件,hermit 是项目的启动文件。
  • config/: 存放项目的配置文件,hermit.toml 是主要的配置文件。
  • content/: 存放网站的内容文件,_index.md 是首页的内容,posts/ 目录下存放博客文章。
  • static/: 存放静态资源文件,如图片、CSS、JavaScript 等。
  • templates/: 存放 HTML 模板文件,base.html 是基础模板,post.html 是文章模板。
  • themes/: 存放主题文件,default/ 是默认主题。
  • .gitignore: Git 忽略文件列表。
  • LICENSE: 项目的开源许可证。
  • README.md: 项目的说明文档。
  • hermit.go: 项目的主程序文件。

2. 项目的启动文件介绍

项目的启动文件是 bin/hermit。这个文件是一个可执行文件,用于启动 Hermit 项目。

启动命令

./bin/hermit serve

该命令会启动 Hermit 项目的服务器,默认监听 http://localhost:8080

3. 项目的配置文件介绍

主要的配置文件是 config/hermit.toml。这个文件使用 TOML 格式,包含了项目的各种配置选项。

配置文件示例

title = "Hermit Blog"
base_url = "http://localhost:8080"
theme = "default"

[params]
author = "John Doe"
description = "A simple static site generator"

[taxonomies]
tag = "tags"
category = "categories"

配置项介绍

  • title: 网站的标题。
  • base_url: 网站的根 URL。
  • theme: 使用的主题名称。
  • params: 其他参数,如作者信息、网站描述等。
  • taxonomies: 分类和标签的配置。

通过修改 hermit.toml 文件,可以自定义 Hermit 项目的各种设置。

登录后查看全文
热门项目推荐
相关项目推荐