0

Please help me to add taxonomy terms from custom taxonomy into home page. I have no idea how to do this as I'm coming from WordPress. In WordPress it is easy as calling get_terms(). I have following file as my home page: mytheme/templates/page--front.html.twig

I have more than one taxonomy type and all of them are going to queried in the home page.

How to query the taxonomy terms?

UPDATE:

I have created a new region called home_content in my theme.info.yml and I have created a view(block) for getting the taxonomy terms, added it to region in back-end and display it as {{page.home_content}}. It works but I have few questions.

  1. I have fields for logo and text in the taxonomy. I want to list them too.

  2. I need to customize the html. How can I do that?

Thanks for the support.

1

Just create a view and list out taxonomy terms. Then display the view in front page.

Need to place view in page--front.html.twig.

Use Twig tweak module.

<dd>{{ drupal_view('view_name', 'page_1') }}</dd>

For Block

{{ drupal_view('view_name', 'block_1') }}
  • Please explain further. I have no experience with drupal. – Janaka Dombawela Jul 3 '17 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.