Created
February 15, 2016 21:08
-
-
Save RainbowArray/b4fd03e4473ed8a6c7eb to your computer and use it in GitHub Desktop.
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent!! Thx u!