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

Cascade with _target discriminator only works for TOML frontmatter #7874

Closed
gwatts opened this issue Oct 22, 2020 · 1 comment · Fixed by #7875
Closed

Cascade with _target discriminator only works for TOML frontmatter #7874

gwatts opened this issue Oct 22, 2020 · 1 comment · Fixed by #7875
Milestone

Comments

@gwatts
Copy link
Contributor

gwatts commented Oct 22, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.76.5/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes (and with master)

Defining a cascade with the new _target discriminator (#7782) using TOML for the frontmatter works as expected, using other formats such as YAML causes the cascade to be ignored completely

This appears to be due to the way that the TOML library unmarshals slices. I have a fix working locally; will open a PR shortly

gwatts added a commit to gwatts/hugo that referenced this issue Oct 22, 2020
TOML unmarshals slices of string maps to []map[string]interface{}
whereas YAML and JSON decode to []interface{}

The existing tests only check for TOML working correctly, and _target
did not work at all for frontmatter defined in other formats.

Add a function to normalize those slices

Fixes gohugoio#7874
gwatts added a commit to gwatts/hugo that referenced this issue Oct 22, 2020
The TOML lib unmarshals slices of string maps to []map[string]interface{}
whereas YAML and JSON decode to []interface{}

The existing tests only check for TOML working correctly, and _target
with cascade did not work at all for frontmatter defined in other formats.

Add a function to normalize those slices

Fixes gohugoio#7874
@bep bep added the Bug label Oct 22, 2020
@bep bep added this to the v0.77 milestone Oct 22, 2020
@bep bep closed this as completed in #7875 Oct 22, 2020
bep pushed a commit that referenced this issue Oct 22, 2020
The TOML lib unmarshals slices of string maps to []map[string]interface{}
whereas YAML and JSON decode to []interface{}

The existing tests only check for TOML working correctly, and _target
with cascade did not work at all for frontmatter defined in other formats.

Add a function to normalize those slices

Fixes #7874
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants