At the moment, if you have multiple items whose names only differ in their extension, and at least one of them is binary, your options for getting metadata onto those items are very limited:
You can put metadata on the textual ones as front matter and have no metadata on the binary item.
You can have a separate .yaml file. Any metadata there applies to all of the items, and any textual items' front matter is processed as content rather than front matter.
One possibility would be to allow x.y.yaml to supply metadata for x.y if present.
My workround for this is to have a sideways.yaml like this:
#
# Metadata to apply to other items.
#
# Use this to, for example, get around the fact that you can't apply
# independent metadata to two items whose names only differ by extension.
# This is relevant when one or the other (or both) are binary.
#
# "apply" is a hash keyed by item identifiers (which will end up as symbols
# once ingested). The values are hashes of key=>value for each attribute
# to be set on the target item.
#
apply:
'/static/ca/iay-ca-g1-2006.cer':
redirects: /ca/iay-ca-g1-2006.cer
'/static/ca/iay-ca-g1-2006.crt':
redirects: /ca/iay-ca-g1-2006.crt
'/static/ca/iay-ca-g1-2011.cer':
redirects: /ca/iay-ca-g1-2011.cer
'/static/ca/iay-ca-g1-2011.crt':
redirects: /ca/iay-ca-g1-2011.crt
In the preprocess rule:
#
# Apply sideways metadata.
#
@items['/sideways.yaml'][:apply].each do |id, md|
item = @items[id.to_s]
md.each do |key, value|
item[key] = value
end
end
That works, but there's no part of it that I like.
At the moment, if you have multiple items whose names only differ in their extension, and at least one of them is binary, your options for getting metadata onto those items are very limited:
.yaml
file. Any metadata there applies to all of the items, and any textual items' front matter is processed as content rather than front matter.One possibility would be to allow
x.y.yaml
to supply metadata forx.y
if present.My workround for this is to have a
sideways.yaml
like this:In the
preprocess
rule:That works, but there's no part of it that I like.