Why is the site.categories array not being output in Jekyll?
Asked Answered
N

1

6

I'm building pages (not posts) in Jekyll. One page defines 2 categories in the front-matter as follows:

categories: [document, new]

And then in a layout I'm trying to output the categories object/array, but nothing is being output:

<h1>Array: {{ site.categories }}</h1>

Why wouldn't this output an array as expected?

Neologism answered 6/5, 2015 at 16:25 Comment(0)
A
4

Only post's categories are used to populate site.categories array.

In a page, the only way to access categories, from the front matter, is {% for category in page.categories %}. And to scope is restricted to the page itself. :-(

Airliner answered 6/5, 2015 at 16:53 Comment(1)
This is 100% effed.Agripinaagrippa

© 2022 - 2024 — McMap. All rights reserved.