Goldsmith-FrontMatter Goldsmith

golang goldsmith goldsmith-components goldsmith-frontmatter json markdown mit license toml web yaml

The Goldsmith-FrontMatter plugin extracts the metadata stored in your content. This metadata can include any information you want, but typically contains the page title, creation date, tags, layout template, and more. It is important to point out that there are no requirements about what information must be present; this is entirely up to you to decide.

Usage

This plugin accepts Markdown, reStructuredText, and HTML files. File contents are logically divided into metadata and content segments, the two being separated by markers indicating which parser to use during processing. It valid to have content with no metadata; however, if metadata is present, it should begin on the first line of the file.

For TOML, the metadata is indicated by three plus (+) characters as shown below:

+++
title = "My homepage"
tags = ["best", "page", "ever"]
+++

Page content goes here.

For JSON, use the curly brace characters ({ and }) to specify your metadata as follows:

{
    "title": "My homepage",
    "tags": ["best", "page", "ever"]
}

Page content goes here.

Finally, to use YAML, you can use three minus (-) characters to designate your metadata:

---
title: "My homepage"
tags:
  - "best"
  - "page"
  - "ever"

Page content goes here.

As mentioned previously, it is important that metadata comes at the beginning of the file. As such, the metadata in the example below will not be interpreted correctly:

This text breaks my metadata!

+++
title = "My homepage"
tags = ["best", "page", "ever"]
+++

Page content goes here.

Upon parsing metadata contained in the provided files, the Goldsmith-FrontMatter plugin outputs files with the this section stripped out. These transformed files are now ready for further processing by plugins such as Goldsmith-Markdown or Goldsmith-Layout further down the Goldsmith chain.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.