I have a jekyll project with two pages, each backed by YAML maps that both reference each other. For example:
a: &a
name: "Ay"
parents: []
children: [*b]
b: &b
name: "Bee"
parents: [*a]
children: []
Vanilla YAML seems not to support using an alias/anchor before its been defined, which invalidates this strategy. Is there any way, perhaps using liquid-fu that would let me generate pages that enumerate an entry's parents and children?
You just need to give the value on first occurrence:
a: &a
name: "Ay"
parents: []
children:
- &b
name: "Bee"
parents: [*a]
children: []
b: *b
The alias/anchor construct has been designed specifically for this use-case. Since the parsed YAML data does not distinguish the place where the object is anchored and the place where it is referenced, this is equivalent to what you want to have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With