FFF
将数据结构转换为 FFF
配置参数
- extensions string[]
The list extensions this plugin applies to
Default:[ ".html" ]
- presets object[]
The list of presets to apply
See https://fff.js.org/concepts/flavor-transform.html#fff-transform-preset
- strict boolean object
- Default:
false
- date created updated published
To convert the generic
date
field to one of these values- getGitDate boolean
Get the date from the git history
- postTypeDiscovery boolean
Description
FFF 是一种 front matter 规范,旨在与框架无关,因此你可以将你的数据复用于不同的静态站点生成器,如 Hexo、Hugo 或 Lume。
此插件将页面数据转换为遵循 FFF 标准,因此如果你在任何其他 SSG 中使用此标准并想迁移到 Lume(或_反之亦然_),此插件应该可以简化迁移过程。
Installation
在你的 _config.ts
文件中导入此插件以使用它:
import lume from "lume/mod.ts";
import fff from "lume/plugins/fff.ts";
const site = lume();
site.use(fff(/* Options */)); // 选项
export default site;
Usage
该插件可以使用 Flavor Transform feature 来修改页面数据。
例如,Lume 的 数据模型 使用变量 date
来保存页面日期。但是 date
可以有多种含义(创建日期、最后更新日期、发布日期等)。FFF 标准定义了三个日期变量:created
、updated
和 published
,它将从 date
变量创建一个这些变量中的一个:
site.use(fff({
date: "published", // 从变量 'date' 创建变量 'published'
}));
请参阅 FFF 文档 以获取更多信息。