jbake-org / jbake

Java based open source static site/blog generator for developers & designers.
http://jbake.org
MIT License
1.12k stars 326 forks source link

Allow metadata in sidecar files (same name, yet defined possible metadata file extensions) of content #379

Open wadechandler opened 7 years ago

wadechandler commented 7 years ago

Currently the metadata of a content file must be provided in a sort of "front matter" style like Jekyll does (when embedded). This forces a foreign syntax into the content files themselves.

This feature request proposes a backward compatible change to allow a sidecar file supported in pure YAML or JSON syntax such that if a content file named some-content.html were to exist, and the system were to find a sidecar file named either some-content.yaml or some-content.yml or some-content.json the sidecar file would be parsed with either a YAML or JSON parser, and the metadata would be extracted from this file.

This has several benefits:

  1. The content file will not be polluted with foreign syntax of the "front matter" or metadata and its separator.
  2. Looking at a directory of content it will be easier to edit just the metadata or content, or even see content files which need metadata added for them; even easier to parse with scripting when transitioning a site.
  3. Editing the metadata in a structured format allows for true YAML or JSON of the values unlike the pseudo JSON support in the metadata file prefix. This is easier to edit and understand.
  4. YAML and JSON file formats are readily supported by multiple editors and IDEs where embedded syntax in content is not necessarily easily supported without extensions which know about JBake.
  5. Just as metadata is parsed from the head of a file, it can be detected easily alongside content.
jonbullock commented 7 years ago

Relates to #32