A
A
atom-code2020-11-12 14:50:31
Drupal
atom-code, 2020-11-12 14:50:31

How to set a separate template for content type in Drupal 8?

Hello.
I use Drupal 8. Actually, the question is for experts, who can explain to me in an accessible way how to get out of a difficult situation.
There is a content type, Lawyers & Attorneys, and there is a page.html.twig page template that I want to slightly modify and use for the Lawyers & Attorneys content type .
I know that you can use your own page template for nodes by changing the name from page.html.twig to page--node-node-number.html.twig
Yes, it works, but I won’t create a separate one for each page (node) template file, I have more than 200 pages with this type of material.
I read a couple of articles, but did not understand how to usehook_theme_suggestions_page_alter() , because with it, my problem can be solved.
How can I make the content type Lawyers and Attorneys use a separate page template? You need to use a template based on page.html.twig , not node.html.twig .
Please tell me how to solve this issue?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
archelon, 2020-11-12
@atom-code

https://www.drupal.org/forum/support/theme-develop...

A
atom-code, 2020-11-12
@atom-code

Thank you all guys) figured it out, helped a lot.
If anyone comes across such a problem, here is the article https://befused.com/drupal/page-template-content-type , it explains everything very well.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question