2.0.17 • Published 1 year ago
@sphido/frontmatter v2.0.17
@sphido/frontmatter
Front matter is an optional section of valid
YAML that is placed at the top of a page and is used for maintaining metadata for the
page and its contents. @sphido/frontmatter
is page
extender that process this
blocks inside page.content
. Using the fastest Node.js YAML Parser js-yaml.
Install
yarn add @sphido/frontmatter
Example
#!/usr/bin/env node
import {getPages, allPages} from '@sphido/core';
import {dirname, relative} from 'node:path';
import {frontmatter} from '@sphido/frontmatter';
const pages = await getPages({path: 'content'}, frontmatter);
for (const page of allPages(pages)) {
console.log(page)
}
How to add front matter block
- Must be first in the file
- Must be valid YAML
- Can be closed between triple-dashed lines
---
and---
or HTML comments<!-- -->
---
title: Page title
tags: [one, two, other]
---
# Content
Lorem ipusm...
or
<!--
title: Page title
tags: [one, two, other]
-->
# Content
Lorem ipusm...
Source codes
2.0.15
1 year ago
2.0.17
1 year ago
2.0.14
1 year ago
2.0.13
1 year ago
2.0.11
2 years ago
2.0.12
2 years ago
2.0.9
2 years ago
2.0.10
2 years ago
2.0.6
2 years ago
2.0.5
3 years ago
2.0.3
3 years ago
2.0.4
3 years ago
1.1.0
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.5
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
6 years ago