Post list from taxonomy not working

This is really killing me, but I can’t figure out what’s going on and any insight would be enormously appreciated. I’m trying to return a list of all posts in a category using:

{% for post in taxonomy.findTaxonomy({'category': ['patterns']}) %}
      <td class="title">{{ post.title }}</td>
      <td class="summary">{{ post.summary }}</td>
      <td class="link"><i class="fa fa-rocket"></i> <a href="{{ post.url }}" title="view the {{ post.title }} micro-pattern">view it!</a></td>
  {% endfor %}

There are at minimum 30 posts under that category, but this loop returns nothing. I tried:

{% for post in taxonomy.findTaxonomy({'category': 'patterns'}) %}
{% for post in taxonomy.findTaxonomy({'category': [patterns]}) %}

To no avail. I’d even be happy with a list of all posts right now, so I can dwindle it down by specific titles.


This seemed to work for me, maybe you just forgot to add the single quotes around your terms?

{{ debug(taxonomy.findTaxonomy({'category': ['patterns']})) }}

How are your taxonomies set in the .md-files?

here’s my front matter:

title: Header
  category: [gui-design, patterns]
  tag: [Brand,PuppetEnterprise,ElapsedTime]

twig_first: true
  twig: true

body_classes: "pattern definition"

status: incomplete

  enabled: true
  mpNames: [Buttons,TimeStamp,EmptyTable,LipBalm]

As far as I can tell, there’s something odd happening when I call the macro. So I just put the following in the code for the template and it runs fine.

{% if header.micro_patterns.enabled %}
          <section class="micro-patterns">
              <h3><i class="fa fa-cubes"></i> Micro-patterns</h3>
              <table class="definition-table">
                    <th class="title">Title</th>
                    <th class="link">Link</th>
                  {% for i, mpost in taxonomy.findTaxonomy({'category': ['patterns']}) %}
                    {% for j, name in header.micro_patterns.mpNames %}
                    {% if (name == mpost.title) %} 
                      <td class="title">{{ name }}</td>
                      <td class="link"><i class="fa fa-rocket"></i> <a href="{{ mpost.url }}" title="view the {{ mpost.title }} micro-pattern">view it!</a></td>
                    {% endif %}
                    {% endfor %}
                  {% endfor %}
        {% endif %}

There might have been some goofiness going on with having nested for loops as well, but the above code works like I need it to - just not from a macro.

Macros are tricky, you have to pass everything to the macro or use global twig variables or they will not be able to access them.