Sphido logo

@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 fastest Node.js YAML Parser js-yaml.

Install

yarn add @sphido/frontmatter

Example

const globby = require('globby');
const Sphido = require('@sphido/core');
const frontmatter = require('@sphido/frontmatter');

(async () => {

  const pages = await Sphido.getPages(
    await globby('content/**/*.{md,html}'),
    frontmatter
  );

})();

How to add front matter block

---
title: Some page title
tags: [one, two, other]
---

# Content

Lorem ipusm...

or

<!--
title: Some page title
tags: [one, two, other]
-->

# Content

Lorem ipusm...

Source codes

https://github.com/sphido/sphido/tree/master/packages/sphido-frontmatter