How can I make Jekyll use a layout without specifying it?

Shorter and with no monkey-patching:

# _plugins/implicit_layout.rb
module ImplicitLayout
  def read_yaml(*args)
    super
    self.data['layout'] ||= 'post'
  end
end

Jekyll::Post.send(:include, ImplicitLayout)

Caveat: GH Pages won't run your plugins.


This can be done using Frontmatter defaults:

defaults:
  -
    scope:
      path: "" # empty string for all files
    values:
      layout: "default"

This setting is available since Jekyll Version 2.0.0.