1

I am trying to create custom node template in Drupal8. I would like my users accessing "tag" node to be able to view all related content. Therefore I have already created a view presenting all content relating to given tag. Now I want to render this view in a "tag" node page.

Following the https://www.drupal.org/node/2165673 I have create a custom theme. I have created themes/bartikUzbrojeni directory with the following bartikUzbrojeni.info.yml:

name: bartikUzbrojeni
type: theme
description: Modifications to the default Bartik theme
core: 8.x
base theme: bartik

I have also created templates directory within themes/bartikUzbrojeni with file node--tag.html.twig (being generally copy of node.html.twig from bartik directory).

This seems to more or less work (modifications done within node--tag.html.twig are visible within the page) but I have following problems:

  1. The page does not look like Bartik one (the bartik theme does not seem to be used even though I have marked it as a "base theme"). Please see screen below.
  2. I don't know what is the proper way to edit node--tag.html.twig so that it renders a view.

enter image description here

  • is your view a page view or a block view? – No Sssweat Nov 8 '15 at 1:04
  • It is a 'page view'. However, if this matters I can also create a 'block view'. – Abdel5 Nov 8 '15 at 8:49
1

Here is how you can add the view, use a block view.

Then go to Blocks, and place a block in content.

Select your view block

enter image description here

In configure click on pages, then type the url of the pages you want it to show. So you put your tags url here. Use the * so it shows in all of them.

enter image description here

Just noticed I missed a / at the start, so it should be /taxonomy/term/*

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.