Skip to content

Deep Merge of Frontmatter #695

@rickychilcott

Description

@rickychilcott

Bridgetown Version:
bridgetown 1.2.0.beta5 "Bonny Slope

To Reproduce
Create a resource with multiple levels of frontmatter:

---
example:
  from_resource: "from resource"
---

and also set config defaults:

defaults:
  - scope:
      path: "articles"
    values:
      layout: default
      example:
        from_config: "from config"

The defaults get totally clobbered and you don't get a value at resource.data.example.from_config

See example repo: https://github.com/rickychilcott/bridgetown-deep-merge-test

Current behavior
Last one wins

Expected behavior
Deep merge of front matter.

Computing environment (please complete the following information):

  • OS: Mac OS X
  • Browser: Brave
  • Browser Version: Version 1.46.153 Chromium: 108.0.5359.128 (Official Build) (arm64)
  • Ruby Version: 3.0.3p157

Additional context
I looked around the source to try to figure out where to write a failing test and ultimately a fix, but I couldn't find where to fix it. I did see the Utils.deep_merge_hashes utility class and it being used, but wasn't sure where to plug it in or the specs to modify to drive out the behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions