Share Post Metadata Across Your Jekyll Site with Front Matter Defaults
Use Jekyll front matter defaults in _config.yml to set layout, author, and category once, then override per post.
27 Sept 2025, 21:21 UTC

The problem: repeating the same front matter on every post
If you run a Jekyll blog, you probably copy a block of YAML into every new post: layout, author, category, maybe published. Front matter is the YAML block at the top of a Markdown file, between --- markers, that Jekyll reads to determine how to render the page.
When you decide to rename a category or switch every post to a different layout, you face the same edit in dozens of files. It is easy to miss one, and posts without layout may not render at all.
The approach: declare defaults once in _config.yml
Jekyll core includes front matter defaults. You add a defaults list to _config.yml. Each entry pairs a scope with values. The scope tells Jekyll which files the rule applies to; the values supply the YAML keys those files inherit.
A file's own front matter always wins. If the default says layout: post and a post says layout: home, the post uses home. There is no unset key; you must restate a value to change it.
Worked example: shared metadata for posts and pages
Open _config.yml in your site root. You need write permission to the file. Add or edit the defaults section like this:
defaults:
- scope:
path: ""
type: posts
values:
layout: post
author: "Engineering Team"
category: engineering
published: true
- scope:
path: ""
type: pages
values:
layout: page
sitemap: true
path: "" means the default applies throughout the site. type: posts limits the first block to files in _posts; type: pages limits the second to pages. This keeps blog metadata from leaking into unrelated pages.
Verify the defaults took effect
Run these commands from your site's root directory. No elevated permissions are required.
- Check your Jekyll version:
jekyll -v. This feature is supported in Jekyll 3.9 and 4.x. - Create a test post at
_posts/2026-12-04-test-defaults.mdwith no front matter, or with onlytitle:
---
title: Defaults test
---
- Build the site:
jekyll build. If_config.ymlhas invalid YAML indentation, the build stops and Jekyll prints an error instead of generating_site. - Inspect the generated HTML, for example
_site/2026/12/04/defaults-test/index.html. Look for the default layout output, such as alayout: posttemplate artifact or the author byline you set in defaults. - Run
jekyll doctorto catch configuration problems before deploying.
To confirm overrides work, add layout: page to the test post's front matter, rebuild, and verify the generated HTML uses the page layout instead of the post layout.
Limitations to plan around
- Drafts are excluded by default. Files in
_draftsare not built unless you runjekyll build --drafts, so they do not receive post defaults in a normal build. - Changes require a rebuild. Defaults resolve at build time. Editing
_config.ymldoes not update published pages until you runjekyll buildagain or restart the server. - You cannot remove a default. If a default sets
published: true, a post must explicitly setpublished: falseto override it. - Indentation breaks the config. YAML is sensitive to spaces. Validate with
jekyll doctorafter editing.
Rollback
Because editing _config.yml changes repository state, revert the file to its previous version and run jekyll build again if defaults cause unexpected output.
Closing
Front matter defaults are a built-in, plugin-free way to stop duplicating metadata across a Jekyll site. Scope them by collection or path, verify with jekyll build and jekyll doctor, and remember that individual posts can always override what you set globally.