timber/starter-theme

Empty img element when there is no featured image

rmens opened this issue · 3 comments

rmens commented

When a post has no featured image, there is an empty <img src=""> element in each single post. Singe.twig seems to assume there is always a featured image on a post, which is not always true. There should probably be a check on that.

Great call @rmens! Seems like it's a quick fix, but I want to give you first crack at the PR opportunity. Could you handle the fame and glory?

I feel that this sort of thing is project-specific. It's very simple to add a conditional to render this if a featured image is present or not, and as a starter theme, it does assume a featured image would be present. Similarly, it is project-specific that you may define a default featured image if one isn't selected as well as any other attr that the image may have.

I think A small check to add to a single page is not really that hard to do and gives a good example. I will mark this as an enhancement.