Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benbalter/jekyll-optional-front-matter
A Jekyll plugin to make front matter optional for Markdown files
https://github.com/benbalter/jekyll-optional-front-matter
github-pages jekyll jekyll-ecosystem yaml
Last synced: 29 days ago
JSON representation
A Jekyll plugin to make front matter optional for Markdown files
- Host: GitHub
- URL: https://github.com/benbalter/jekyll-optional-front-matter
- Owner: benbalter
- License: mit
- Created: 2016-09-11T16:36:39.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2021-10-31T09:13:08.000Z (about 3 years ago)
- Last Synced: 2024-10-09T12:09:39.745Z (2 months ago)
- Topics: github-pages, jekyll, jekyll-ecosystem, yaml
- Language: Ruby
- Size: 86.9 KB
- Stars: 83
- Watchers: 10
- Forks: 27
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- Funding: .github/funding.yml
- License: LICENSE.md
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: docs/SECURITY.md
Awesome Lists containing this project
- awesome-jekyll-plugins - **Optional Front Matter** - optional-front-matter](https://rubygems.org/gems/jekyll-optional-front-matter)) by Ben Balter -- makes front matter optional for markdown files (Settings & Configurations Tweaks)
README
# Jekyll Optional Front Matter
A Jekyll plugin to make front matter optional for Markdown files
[![CI](https://github.com/benbalter/jekyll-optional-front-matter/actions/workflows/ci.yml/badge.svg)](https://github.com/benbalter/jekyll-optional-front-matter/actions/workflows/ci.yml)
## What it does
Out of the box, Jekyll requires that any markdown file have YAML front matter (key/value pairs separated by two sets of three dashes) in order to be processed and converted to HTML.
While that behavior may be helpful for large, complex sites, sometimes it's easier to simply add a plain markdown file and have it render without fanfare.
This plugin does just that. Any Markdown file in your site's source will be treated as a Page and rendered as HTML, even if it doesn't have YAML front matter.
## Usage
1. Add the following to your site's Gemfile:
```ruby
group :jekyll_plugins do
gem 'jekyll-optional-front-matter'
end
```
2. Install the plugin.
- Using Bundler.
```bash
$ bundler install
```
- Using Gem.
```bash
$ # Install in your user's home directory.
$ gem install jekyll-optional-front-matter --user-install
$ # Install for root user.
$ sudo gem install jekyll-optional-front-matter
```
3. Add the following to your site's config file:
```yml
plugins:
- jekyll-optional-front-matter
```Note: If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.
## One potential gotcha
In order to preserve backwards compatibility, the plugin does not recognize [a short list of common meta files](https://github.com/benbalter/jekyll-optional-front-matter/blob/master/lib/jekyll-optional-front-matter.rb#L4).
If you want Markdown files like your README, CONTRIBUTING file, CODE_OF_CONDUCT, or LICENSE, etc., you'll need to explicitly add YAML front matter to the file, or add it to your config's list of `include` files, e.g.:
```yml
include:
- CONTRIBUTING.md
- README.md
```## Configuration
You can configure this plugin in `_config.yml` by adding to the `optional_front_matter` key.### Removing originals
By default the original markdown files will be included as static pages in the output. To remove them from the output, set the `remove_originals` key to `true`:
```yml
optional_front_matter:
remove_originals: true
```### Disabling
Even if the plugin is enabled (e.g., via the `:jekyll_plugins` group in your Gemfile) you can disable it by adding the following to your site's config:
```yml
optional_front_matter:
enabled: false
```