Drupal

Blog

Patching workflow in drupal 8 & 9

How do we correctly patch our core and modules in drupal?

Blog

Get paragraph type in preprocess_paragraph in drupal 8 & 9

Preprocessing on paragraphs is not used very often. But when needed, here is a snippet that gets you the correct type to add some preprocessing.

Blog

Add body classes in drupal 8 & 9

There are two ways of adding body classes. The first is to add them in twig, the second is to provide additional classes in mytheme.theme.

Blog

Add the year to your page.html.twig file

Snippet to dynamically add the year to your page.html.twig file.

Blog

Get the current url path alias in drupal 8, 9 & 10

This snippet sums op the possibilities of getting the current url path alias.

Blog

Get is_front frontpage variable in node.html.twig twig file

This is quite an easy one. I want to know in my node.html.twig file if i'm on the homepage of the site. This snippet does the trick.

Blog

Get logo path of custom theme in page.html.twig in drupal 8 or 9

The site logo moved to a block in drupal 8 but with this snippet you are still able to get the custom logo path, as defined in your settings file.

Blog

Scrape first available text from your node and save them as meta description in drupal 8

Metatags can be hard when abandoning the body field in favor of paragraphs. This post gives you a generic solution for the problem.

Blog

Set first paragraph text as description of metatag

Most websites abandon the body field in favor of paragraphs. One flaw this has, is that no longer a summary is provided for your (auto-generated) meta description. This snippet fixes this issue.

Blog

Prevent drupal from sending e-mails [drupal 8 or 9]

There are use cases where you do not want drupal to send any mails at all. Here's a snippet that does the trick.

Subscribe to Drupal