You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hold that site data/metadata is a form of content, and as such, I am adamant about maintaining it separately from site implementation. I had previously kept metadata in .yaml and that has been fine with 11ty also, once I extended 11ty to support YAML.
One of the things most people love about 11ty is its data cascade, which makes this global metadata, well, global. But I'd really, really like to namespace the global data to avoid unintentional merges and conflicts. I do not want any of my truly global site metadata to be mutable, and as such, I don't need it merged.
I suppose a use case would be more helpful here.
Currently I have a notion of being able to group content into "series." The series themselves are defined in a metadata file, series.yaml. I do want metadata about the various series-es to be available globally.
To associate a piece of content with a series, what I'd like to be able to do is add a metadata (e.g. front-matter) key to that content, series, that could reference the identifier (slug in my case) of the series in which it should be included. However, I cannot do that because this local series value would merge and overwrite the global series value (array of "series" objects).
What I want in the context of the piece of context's template on render is something like:
{
global: {
series: [
{
slug: 'my-series-slug',
title: 'A series of thingies',
description: 'Some sort of thingy batch',
},
// ...
],
},
series: 'my-series-slug',
// ...
}
but what I get is:
{
series: 'my-series-slug',
// ...
}
Because the local series value obliterates the global one. So I've lamed out and used a local key of inSeries, so that I get:
{
series: [
{
slug: 'my-series-slug',
title: 'A series of thingies',
description: 'Some sort of thingy batch',
},
// ...
],
inSeries: 'my-series-slug',
// ...
}
This does not satisfy me, though I understand it's by design. I've ended up with a content metadata key that is named awkwardly as a result of implementation details of eleventy.
11ty keys global metadata by its filename, i.e. series.yaml in my case becomes a top-level series entry in template context. I could rename the file (and as such probably all global data files to establish a convention) with a prefix, e.g. But then I'm renaming my source data files to account for a 11ty implementation detail.
There may be some entirely straightforward way to accomplish this that I just haven't googled onto yet.
The text was updated successfully, but these errors were encountered:
I hold that site data/metadata is a form of content, and as such, I am adamant about maintaining it separately from site implementation. I had previously kept metadata in
.yaml
and that has been fine with 11ty also, once I extended 11ty to support YAML.One of the things most people love about 11ty is its data cascade, which makes this global metadata, well, global. But I'd really, really like to namespace the global data to avoid unintentional merges and conflicts. I do not want any of my truly global site metadata to be mutable, and as such, I don't need it merged.
I suppose a use case would be more helpful here.
Currently I have a notion of being able to group content into "series." The series themselves are defined in a metadata file,
series.yaml
. I do want metadata about the various series-es to be available globally.To associate a piece of content with a series, what I'd like to be able to do is add a metadata (e.g. front-matter) key to that content,
series
, that could reference the identifier (slug in my case) of the series in which it should be included. However, I cannot do that because this localseries
value would merge and overwrite the globalseries
value (array of "series" objects).What I want in the context of the piece of context's template on render is something like:
but what I get is:
Because the local
series
value obliterates the global one. So I've lamed out and used a local key ofinSeries
, so that I get:This does not satisfy me, though I understand it's by design. I've ended up with a content metadata key that is named awkwardly as a result of implementation details of eleventy.
11ty keys global metadata by its filename, i.e.
series.yaml
in my case becomes a top-levelseries
entry in template context. I could rename the file (and as such probably all global data files to establish a convention) with a prefix, e.g. But then I'm renaming my source data files to account for a 11ty implementation detail.There may be some entirely straightforward way to accomplish this that I just haven't googled onto yet.
The text was updated successfully, but these errors were encountered: