Skip to content

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

@KajKandler

Description

@KajKandler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions