Skip to content

Instantly share code, notes, and snippets.

View rvizena's full-sized avatar

rvizena

View GitHub Profile
@RainbowArray
RainbowArray / fragment-of-page-html.html.twig
Created February 15, 2016 21:08
Need to include a node field image in the page.html.twig template with Drupal 8? This is the most straightforward way I've found to do so. (This is using the file entity module.)
{% if node.field_hero_image.entity %}
<img src="{{ file_url(node.field_hero_image.entity.uri.value) }}"
alt="{{ node.field_hero_image.alt }}"
{% if node.field_hero_image.title %}
title="{{ node.field_hero_image.title }}"
{% endif %}
/>
{% endif %}