In my article content type, I've added a header image (field_header_image) field which I placed a default image into it so that all articles would have a default image used if one wasn't needed. However, when creating an article and leaving that field as the default value, it doesn't actually use that default value. The page is created as if that value is empty.

Is there any way to make sure that this default value is used?

Is there a way to do this through the .theme file? Is this the best way to do it?


1 Answer 1


If the default image was set correctly then the newly saved article nodes should pick it up. Check if the website's log show any related error messages.

If you want to go with another method then just:

  1. Copy node.tpl.php in your website's themes folder to node--article.tpl.php;
  2. Open node--article.tpl.php in editor and place the following code just before print render($content);:

<img src="/path-to/image/image_file_name.ext">

  1. Save.
  2. Clear your website's cache and revisit any article node.
  • I’m on a Drupal 8 website. I’ve done the above the D8 way and still the default image does not show up. Mar 15, 2018 at 3:10
  • For Drupal 8 read drupal.org/docs/8/theming/twig/twig-template-naming-conventions. So the copy should be called node--type.html.twig.
    – AltaGrade
    Mar 15, 2018 at 13:09
  • The default image was set correctly and there are no error messages. I've created a node--article.html.twig template already and have the content printing...the default image doesn't show up; hence my original question. Is there a way to set the default image through the .theme file? Mar 15, 2018 at 15:32
  • Just creating the file is not enough to get to desired effect, you need to also add code in step #2: <img src="/path-to/image/image_file_name.ext">
    – AltaGrade
    Mar 16, 2018 at 13:40
  • I've done all of that already, still doesn't work. If I print {{ content.field_header_image }}, I get nothing. Even running {{ kint(content.field_header_image) }} comes back as null, even though I have a default image set in the content type. Mar 16, 2018 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.