Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmhooper/jekyll_strict_front_matter
A Jekyll plugin for raising for YAML front matter syntax errors
https://github.com/jmhooper/jekyll_strict_front_matter
frontmatter jekyll jekyll-plugin
Last synced: 3 months ago
JSON representation
A Jekyll plugin for raising for YAML front matter syntax errors
- Host: GitHub
- URL: https://github.com/jmhooper/jekyll_strict_front_matter
- Owner: jmhooper
- License: mit
- Created: 2017-04-30T22:15:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-07T22:00:18.000Z (over 2 years ago)
- Last Synced: 2023-08-01T10:10:26.981Z (over 1 year ago)
- Topics: frontmatter, jekyll, jekyll-plugin
- Language: Ruby
- Size: 13.7 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Gem Version](https://badge.fury.io/rb/jekyll_strict_front_matter.svg)](https://badge.fury.io/rb/jekyll_strict_front_matter)
**This feature is now available in Jekyll 3.5.0 and later by adding `strict_front_matter: true` to `_config.yml`.**
By default, if a page or a post in a Jekyll site has a syntax error in the front matter, Jekyll logs an error, does not render anything for the given document, and continues. The result is a site without any content for the page with the syntax errors.
This can be confusing for people who build sites without looking at the CLI, such as those of us whose sites build in a CI. In these cases, we may wish for our build to fail if there are front matter syntax errors. [This PR](https://github.com/jekyll/jekyll/pull/5832/files) seeks to add a config option for that, but in the meantime this plugin exists to fill the gap. This plugin may also be used to add the option to sites using an older version of Jekyll.
# Using the plugin
To use this plugin, first add the plugin to your Gemfile and run `bundle install`.
```ruby
group :jekyll_plugins do
gem "jekyll_strict_front_matter"
end
```Next, enable `strict_front_matter` by adding the option to your `_config.yml`:
```yaml
strict_front_matter: true
```Now, a syntax error in the YAML should raise an error, stop the build, and result in a non-zero exit code.