The markup for the anchors of the table of contents requires the ID of an HTML element plus a label. This data lends itself to a block mapping in YAML Front Matter, which is a collection of
key: value pairs. After a quick Google search, I found out how to achieve this in Jekyll on Stack Overflow (as is so often the case).
Below is a sample of the YAML Front Matter in one of the handbooks:
And the code to generate the table of contents in the layout:
In the code sample above
chapter gets the key and
chapter the value of the pair, i.e.
An example of the generated HTML is as follows:
Block mapping will allow me to create more complex layouts in Jekyll using YAML Front Matter.
The idea behind the Next handbooks is to document our culture, processes and tools. Anyone at Next can contribute to the them and those outside get an insight in to who we are and how we work.