A long-lived project that still receives updates
Jekyll plugin that silently sets default layouts for pages, posts, and collection documents that don't specify one. Supported on GitHub Pages.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

>= 3.0, < 5.0
 Project Readme

Jekyll Default Layout

Jekyll plugin that silently sets default layouts for pages, posts, and collection documents that don't specify one. Supported on GitHub Pages.

CI

Usage

  1. Add the following to your site's Gemfile:

    gem 'jekyll-default-layout'
  2. And the following to your site's _config.yml:

    plugins:
      - jekyll-default-layout

Note: If you are using a Jekyll version less than 3.5.0, use the gems key instead of plugins.

What it does

If no layout is specified for a Markdown post or page, the plugin automatically sets the "home", "post", "page", or "default" layout if it exists.

What layout is used:

  • /index.md - the home layout, the page layout, or the default layout, if they exist, in that order
  • A page - the page layout or the default layout, if they exist, in that order
  • A post - the post layout or the default layout, if they exist, in that order
  • A collection document - a layout matching the collection name or the default layout, if they exist, in that order

HTML pages

By default, the plugin only applies layouts to Markdown files. To also apply layouts to HTML files that don't specify one, opt in via your _config.yml:

jekyll-default-layout:
  html_pages: true

Disabling

For a specific post or page, add layout: null to the front matter.