{
  "version": "https://jsonfeed.org/version/1",
  "title": "Marmite 0.4.0",
  "home_page_url": "https://marmite.blog",
  "feed_url": "https://marmite.blog/tag-frontmatter.json",
  "description": "Static Site Generator <br> <small>for blogs</small> <br> <small>made with ❤️ and 🦀</small>",
  "items": [
    {
      "id": "https://marmite.blog/folder-level-frontmatter-defaults.html",
      "url": "https://marmite.blog/folder-level-frontmatter-defaults.html",
      "title": "Folder-Level Frontmatter Defaults",
      "content_html": "<p>When multiple posts share the same metadata - stream, tags, date, authors, or extra fields - you can avoid repeating it in every file by placing a <code>frontmatter.yaml</code> in the folder. All <code>.md</code> files in that folder inherit the values as defaults, while still being able to override any field individually.</p>\n<h2><a href=\"#how-it-works\" aria-hidden=\"true\" class=\"anchor\" id=\"how-it-works\"></a>How it works</h2>\n<p>Place a <code>frontmatter.yaml</code> file in any content subfolder. Its key-value pairs become the default frontmatter for all markdown files in that folder.</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner\">content/\n  python/\n    frontmatter.yaml      # defaults for all files in this folder\n    databases.md\n    classes.md\n    web-frameworks.md\n</code></pre>\n<p>The <code>frontmatter.yaml</code> is a plain YAML file (no <code>---</code> delimiters needed):</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner language-yaml\"><a-pr>date</a-pr><a-p>:</a-p> <a-s>2026-01-01</a-s>\n<a-pr>stream</a-pr><a-p>:</a-p> <a-s>python</a-s>\n<a-pr>tags</a-pr><a-p>:</a-p>\n  <a-p>-</a-p> <a-s>python</a-s>\n  <a-p>-</a-p> <a-s>programming</a-s>\n<a-pr>extra</a-pr><a-p>:</a-p>\n  <a-pr>mermaid</a-pr><a-p>:</a-p> <a-co>true</a-co></code></pre>\n<p>With this setup, <code>databases.md</code> only needs its own title:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner language-markdown\"><a-p>---</a-p>\n<a-pr>title</a-pr><a-p>:</a-p> <a-s>Python Databases</a-s>\n<a-p>---</a-p>\n\n<a-p>#</a-p> <a-tt>Working with Databases in Python</a-tt>\n\nContent here...</code></pre>\n<p>It automatically gets <code>date: 2026-01-01</code>, <code>stream: python</code>, the python/programming tags, and <code>extra.mermaid: true</code> from the folder defaults.</p>\n<h2><a href=\"#override-any-field\" aria-hidden=\"true\" class=\"anchor\" id=\"override-any-field\"></a>Override any field</h2>\n<p>Per-file frontmatter always takes precedence over folder defaults. If <code>classes.md</code> needs different tags:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner language-markdown\"><a-p>---</a-p>\n<a-pr>title</a-pr><a-p>:</a-p> <a-s>Python Classes</a-s>\n<a-pr>tags</a-pr><a-p>:</a-p>\n  <a-p>-</a-p> <a-s>oop</a-s>\n  <a-p>-</a-p> <a-s>beginner</a-s>\n<a-p>---</a-p></code></pre>\n<p>This file gets <code>tags: [oop, beginner]</code> instead of the folder defaults, while still inheriting <code>date</code>, <code>stream</code>, and <code>extra</code> from <code>frontmatter.yaml</code>.</p>\n<p>The <code>title</code> and <code>slug</code> fields are never inherited from folder defaults - they are always per-file.</p>\n<h2><a href=\"#root-level-defaults\" aria-hidden=\"true\" class=\"anchor\" id=\"root-level-defaults\"></a>Root-level defaults</h2>\n<p>The <code>content/</code> directory itself can also have a <code>frontmatter.yaml</code> to set defaults for all content across the entire site:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner\">content/\n  frontmatter.yaml        # applies to ALL content\n  python/\n    frontmatter.yaml      # applies to python/ files\n    intro.md\n  2026-01-15-standalone.md # inherits from root only\n</code></pre>\n<p>When both root and subfolder defaults exist, they layer: root defaults apply first, then subfolder defaults override, then per-file frontmatter overrides last.</p>\n<h2><a href=\"#nested-subfolders\" aria-hidden=\"true\" class=\"anchor\" id=\"nested-subfolders\"></a>Nested subfolders</h2>\n<p>Frontmatter defaults work at any nesting depth. Each level inherits from its parent and can add or override values:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner\">content/\n  frontmatter.yaml                  # authors: [admin]\n  tutorials/\n    frontmatter.yaml                # stream: tutorial (inherits authors from root)\n    tutorials/python/\n      frontmatter.yaml              # tags: [python] (inherits authors + stream)\n      basics.md                     # gets all three: authors, stream, tags\n</code></pre>\n<p>Files in nested subfolders without their own <code>frontmatter.yaml</code> inherit from the nearest ancestor that has one. A file at <code>content/tutorials/python/advanced/decorators.md</code> would inherit from <code>content/tutorials/python/frontmatter.yaml</code>.</p>\n<h2><a href=\"#merge-priority\" aria-hidden=\"true\" class=\"anchor\" id=\"merge-priority\"></a>Merge priority</h2>\n<p>From lowest to highest priority:</p>\n<ol>\n<li>Root <code>content/frontmatter.yaml</code></li>\n<li>Parent subfolder <code>frontmatter.yaml</code> files (layered from shallowest to deepest)</li>\n<li>Filename conventions (date, stream, and language detection from the filename)</li>\n<li>The markdown file's own frontmatter block</li>\n</ol>\n<h2><a href=\"#use-with-language-streams\" aria-hidden=\"true\" class=\"anchor\" id=\"use-with-language-streams\"></a>Use with language streams</h2>\n<p>Folder-level defaults work alongside translation groups. A subfolder can be both a translation group and have shared defaults:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner\">content/\n  hello/\n    frontmatter.yaml      # shared defaults\n    hello.md               # default language version\n    pt-ola.md              # Portuguese version\n</code></pre>\n<p>Both translations inherit the folder defaults while still being detected and linked as translations.</p>\n<p>Translation groups work at any nesting depth. Each subfolder forms its own independent group:</p>\n<pre class=\"marmite-code\"><code class=\"marmite-code-inner\">content/\n  poetry/\n    love/\n      love-poem.md         # default language\n      pt-poema-amor.md     # Portuguese translation of love poem\n    nature/\n      nature-poem.md       # default language (separate group from love/)\n      pt-poema-natureza.md # Portuguese translation of nature poem\n</code></pre>\n<p>The <code>love/</code> and <code>nature/</code> subfolders are treated as separate translation groups - translations in one subfolder are not mixed with translations in the other.</p>\n<blockquote>\n<p>Please consider giving a ☆ on Marmite <a href=\"https://github.com/rochacbruno/marmite\">Github</a> repository, that helps a lot!</p>\n</blockquote>\n<!-- Contents from _markdown_footer.md are appended to every content -->\n<!-- _references.md is a file to gather all references together \nthis file is appended to every raw markdown.\n-->\n",
      "summary": "\"Organize content in subfolders with shared frontmatter defaults - reduce repetition by inheriting stream, tags, date, and other metadata from a folder-level configuration file.\"",
      "date_published": "2026-07-04T12:00:00-00:00",
      "image": "media/folder-level-frontmatter-defaults.banner.jpg",
      "authors": [
        {
          "name": "Bruno Rocha",
          "url": "https://go.rocha.social/@bruno",
          "avatar": "https://github.com/rochacbruno.png"
        }
      ],
      "tags": [
        "content",
        "organization",
        "frontmatter",
        "streams",
        "features"
      ],
      "language": "en"
    }
  ]
}