Skip to content
This repository has been archived by the owner on Mar 21, 2018. It is now read-only.

A Jekyll plugin to make front matter optional for Markdown files

License

Notifications You must be signed in to change notification settings

ketozhang/jekyll-optional-front-matter

 
 

Repository files navigation

Jekyll Optional Front Matter

A Jekyll plugin to make front matter optional for Markdown files

Build Status

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:
gem 'jekyll-optional-front-matter'
  1. Add the following to your site's config file:
gems:
  - jekyll-optional-front-matter

One potential gotcha

In order to preserve backwards compatibility, the plugin does not recognize a short list of common meta files.

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.:

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:

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:

optional_front_matter:
  enabled: false

About

A Jekyll plugin to make front matter optional for Markdown files

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 98.7%
  • Shell 1.3%