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

An array of tables in the blurry.toml is overwritten instead of merged with additional elements in front matter #31

Open
KajKandler opened this issue Nov 15, 2023 · 0 comments

Comments

@KajKandler
Copy link
Contributor

Use Case
I'm trying to create composable schema, like Yoast (https://yoast.com/why-schema-needs-to-be-a-graph/ , https://developer.yoast.com/features/schema/functional-specification/)

I order to not repeat myself I tried to put the global definitions for WebSite and Author and Publisher into the blurry.toml. For example:

[[blurry.schema_data."@graph"]]
"@type" = "Person"
"@id" = "https://example.com/#schema/person/1234567890"
name = "Jane Doe"
url = "https://example.com/"
sameAs = [
    "https://www.linkedin.com/in/janedoe/",
]

[[blurry.schema_data."@graph"]]
"@type" = "WebSite"
"@id" = "https://example.com/#website"
name = "example.com"
url = "https://example.com/"

and reference it in the index.md like

+++
"@type" = "WebPage"

[["@graph"]]
"@type" = "WebPage"
"@id" = "https://example.com/"
name = "Home"
abstract = "Jane Doe a software engineer with interest in static site generators."
author."@id" = "https://example.com/#schema/person/1234567890"
isPartOf."@id" = "https://example.com/#website"
+++

However, this does not work, because the array of tables ("@graph") is overwritten as a whole, when merging the blurry.toml and the front matter. I'd expect the arrays of tables to be merged. May be all arrays should be merged instead of overwritten?

P.S.: As you can see I also have to duplicate the '@type' attribute because it has dual meaning (template resolution and schema type), which causes other issues.

When I include the schema from the blurry.toml into the front matter, it works nicely. But that would be a lot of repetition for this "global" info.
It works, if I make the json+ld part of the templates. But that would be not so cool either.

@KajKandler KajKandler changed the title An array of tables in the blurry.toml is overwritten instead of merges with additional elements in front matter An array of tables in the blurry.toml is overwritten instead of merged with additional elements in front matter Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant