Help with collections (not calling pages)

i had quite a bit of difficulty understanding collections, but i feel like i’m getting close now. however this loop is not pulling any pages. it’s sitting in a file called index.md which is in the /docs directory.

<h3>Getting Started</h3>
<ul>
    {% for docs in site.docs %}
      {% if docs.category == "pd" %}
        <li><a href="{{ docs.url }}">{{ docs.title }}</a></li>
      {% endif %}
    {% endfor %}
</ul>

now in the directory called /docs i have a few files with this in the header, which i am expecting to get called from that code above.

---
title: title1
permalink: /docs/title1
layout: default
category: pd
order: 2
collection: docs
---

in the config file:

collections:
 docs: 
    permalink: "/:collection/:path/"
    output: true

yep… just had to make sure the folder had the underscore in front of it. _docs now can get read :+1:

just a note about category - it is already a thing for posts - by using it in a collection I don’t think it will be accessible via site.categories. This could cause some confusion at some point. My guess is you don’t need that but still something to be aware of.

I try to name things as something else - like Type or prod-cat.

2 Likes