Closed Sanci91 closed 1 year ago
This is correct. The following code is fetching the term
entity only.
const resource = await drupal.getResourceFromContext<DrupalTaxonomyTerm>(path,
context,
{
params,
}
)
If you want to fetch articles tagged by this term you need to use something like this:
const nodes = await drupal.getResourceCollectionFromContext(
"node--article",
context,
{
params: {
"filter[field_tags.id]": resource.id,
},
}
)
This will fetch all articles tagged with the term. Which you can then pass as props to render.
Closing this issue as a viable solution is provided.
Hi, I'm trying to show a tag term page. As example I created a url pattern in admin/config/search/path/patterns/add for taxonomy terms of tags vocabulary as
tags/[term:name]
. Then I added in the pages folder a file named term.tsx with the following code:And also a new component called taxonomy_term--tags.tsx with the following code:
I'd expect to visit http://localhost:3000/tags/xyz and find the title of the term, but it is not showing anything. Can you help me? I'm not finding any guide to how show different entities rather than nodes on the documentation.