.GetTerms in depth understanding to debug

I’m using .GetTerms in a few templates.

One one particular section/silo it’s returning 0Pages though the same code in a different layout does what I expect:

I.e.
“Authors” is the Taxonomy.
“Joe Blow” is an Author (in front matter of /grapes-of-wrath/_index.md “authors: Joe Blow”)

In the above page, in the template I put:
(.GetTerms “authors”)

It returns the page /authors/joe-blow/_index.md Which is what I want.

Edit: I don’t have the ability to share the repos involved, so am hoping a direction towards documentation on the “.GetTerms” statement so to understand better and hopefully resolve myself.

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Pardon @jmooring Do see edit above…

https://gohugo.io/templates/taxonomy-templates/#example-list-tags-in-a-single-page-template

It’s a method on .Page so make sure your context (the dot) is correct.

1 Like

Thank you again @jmooring.
I believe I was remiss in noticing/mentioning/understanding my specific use case, but your comment assisted.
Also, I’m unfortunately aware this is difficult due to unavailability of the repo, but the observation and my error seems this, if this helps at all for any reason:

  1. term page “Pie” of Taxonomy “Recipes” cannot be a value of
  2. Taxonomy “Chef”, Term page “John Jones”

So in front matter of term page “Pie” if it states “chefs: John Jones” .GetTerms does not resolve to a page, i.e. returns 0 pags. Where I would think it would have resolved to John Jone’s Term page.

I’m making a workaround for now, but the above is data if it assists you (in assisting me I guess).

It sound like you are trying to add a taxonomy term to a taxonomy term page.
That’s not supported.
Find another way.

1 Like

Just wanted to make sure I’m not missing something. Other handling is no problemo.

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