Why is this boilerplate for .Site.Taxonomies not working?

I have this in my config.toml

category = “categories”

I am using the code here as a reference.

I drop that code into a partial filename.html and then call it into layout passing in the dot context.
{{ partial "filename" . }}

Nothing renders inside the UL tag.

There must be something simple missing that I am not catching, but I can’t see it.

Have you specified one or more categories in the front matter of a content page that is (a) not set to draft, (b) not scheduled in the future, and (c) not expired?

title = "Test"
date = 2021-01-01T00:00:00-00:00
draft = true
categories = ["a","b"]
1 Like

Actually, I just realized the problem and I will leave this question and answer here for others who might make the same mistake.

It’s all about the Context, in this case, it was actually down in a ‘page section’ of my front matter and not at the page level. I needed to pass in an additional variable to the partial with the page context and from there the boilerplate works as expected.

@jmooring thank you for the help on this too.

Hi, I use different taxonomies (not category, it’s only a name).
I use it in single and list templates.

Check out ma Sample Repo

1 Like

Thank you, in this case I just was in the wrong context for what I was trying to do. Once I passed in the proper context through a dict I was able to work with the taxonomy data as I expected. Sometimes when partials call other partials, you have to go up a couple of levels to see what Context the ‘dot’ represents.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.