2.0.17 • Published 2 days ago

@sphido/frontmatter v2.0.17

Weekly downloads
15
License
MIT
Repository
github
Last release
2 days ago

@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

@sphido/frontmatter

2.0.15

2 days ago

2.0.17

2 days ago

2.0.14

2 months ago

2.0.13

3 months ago

2.0.11

4 months ago

2.0.12

4 months ago

2.0.9

7 months ago

2.0.10

6 months ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.3

2 years ago

2.0.4

1 year ago

1.1.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago