node template background image url

See this issue http://drupal.stackexchange.com/questions/137319/getting-the-image-url-f...

...two methods are described and both work.

You can do this in twig:

See: https://www.drupal.org/node/1696760 regarding twig functions and filters.

=====================

Second you can do this in preprocess e.g.:

function HOOK_preprocess_node(&$variables) {
$node = $variables['node'];
$variables['image_url'] = file_create_url($node->field_image->entity->getFileUri());
}
Then in node template:

However, both these will link to the raw image, no image style, also I tend to think this is theming on the wrong level, i.e. you should be theming the FIELD not the NODE. What I mean is theme at the field preprocess or template level, take a look at this issue regarding field templates and image styles:

http://drupal.stackexchange.com/questions/185532/get-an-image-with-style...