Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep Merge of Frontmatter #695

Open
rickychilcott opened this issue Jan 10, 2023 · 0 comments
Open

Deep Merge of Frontmatter #695

rickychilcott opened this issue Jan 10, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@rickychilcott
Copy link
Contributor

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.

@rickychilcott rickychilcott added the bug Something isn't working label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant