This forum is for assistance with theme development.

Adding content between body and comment

Hi there,

I'm trying to add some content between the node content and the comment section.

I use a custom theme based on Classy.

The node.html.twig template in the Classy theme contains this section:

  <div{{ content_attributes.addClass('node__content') }}>
    {{ content }}
  </div>

The content placeholder gives out both the body content and the comment section.

How would i seperate these two, so i can place other content (exaple: block) between the body content and the comment section?

I appreciate any help with this.

field_link Add class

So, I know I can do this through preprocess or even creating a field formatter.

Let's say I don't feel like doing all of that because I consider it overhead. I went and use the following

{{ content.field_link[0]|merge({'#options': {'attributes': {'class': ['your-class my-class']}}}) }}

Now, I had the template for field_link overwritten, and I noticed that when I used this option it stopped using my template. Is there a way to add a Class to a field_link in Twig without it breaking your template?

How to show html depending on current language?

i need something like this:

if (language == en)
    <div class="fancy-box-en"></div>
else if (language == fr)
    <div class="fancy-box-tr"></div>
else if ....etc
endif

Acess paragraph's child fields using content

Hello,

I have the following question. I have a paragraph with the following structure:

Paragraph

- field_paragraph_content

  - field_image

It's a paragraph inside a paragraph

From the Parent Twig Paragraph I want to access what would be in the child's Twig the field content.field_image

My requirement is to print the image at the same level of field_paragraph_content but I don't want to manually create the img tag or use drupal_image() or having to manually declare the Image Styles.

Connecting custom content types to the main menu using Twig template

I created a content type with the name 'Brand' and a field that contains three categories which are separate pages on the website. Each of those categories are also shown in the menu. Now I want to create a submenu below each category in the menu where the 'Brand' pages are shown which are connected to the selected category. Is there a way to do this in Twig?

Currently I have the following template where I want to show the items.

Awesome themes i want to develop

Hello

I have just informed that the major newspaper and magazine national websites in Greece are made from Drupal! For example https://www.ethnos.gr/ or https://www.sdna.gr/. 

I have just start learning Drupal while im building websites with wordpress

I want to ask just a question. How can i freely design my regions on a web site in drupal where i would place my blocks like the websites i mentioned above? 

Pages

Subscribe with RSS Subscribe to RSS - Theme development