Forum:How to make template:person without image

ShoutWiki — express yourself and be heard!
Jump to navigation Jump to search

Forums: Index Community help

I want to create some Template:Person infoboxes but without an image. However, if I do not include an image, this code shows up: [[File:{{{image}}}|250px|link=]]. Basically, how do I make it so that that does not show up when there is no image? I have already experimented a little in the code but nothing works. --Sculdermully (talk) 22:34, 18 May 2019 (UTC)

I assume you mean you want to use an image if you have one, but not use one if you don't. You need to test for the existence of {{{image}}} before using it. Something like
{{#if:{{{image|}}}|[[File:{{{image}}}|250px|link=]]}}
You might have to put more of the markup that surrounds the image inside the #if, depending on how you've written the rest of the template. --Saftzie (talk) 00:34, 19 May 2019 (UTC)
Thank you, it worked! The thing was that I didn't insert braces at the end of the #if syntax. --Sculdermully (talk) 02:07, 19 May 2019 (UTC)