5
votes

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?

1

1 Answers

3
votes

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. :-(