Search code examples
harp

How to match metadata with a nested file?


My _layout.jade file

(...)
if toc
    div(id='toc', class="")
(...)

makes use of a variable set in _data.json:

{
    "handbook": {
        "toc": true
    },
    "incidents/incidents": {
        "toc": true
    }
}

This works fine for handbook.md located in the root directory, but incidents.md located in the directory incidents is not matched. I tried to have a bare "incidents" in _data.json, but it is not matched either.

How should I reference /incidents/incidents.md in _data.json?


Solution

  • Try adding a _data.json file in the incidents/ directory too. That’s where you’ll specify all the metadata for the pages in that folder:

    {
      "incidents": {
        "toc": true
      }
    }
    

    Then /incidents/incidents will have the toc variable, too.