I'm creating a template that will use images to link to 1 or 2 other wikis on the platform. The template will be called by:
Example 1: {{TemplateName|wiki1|wiki2}}
or
Example 2: {{TemplateName|wiki1=PageABC|wiki2=PageXYZ}}
The parameters "wiki1" and "wiki2" should link to the page on those other wikis based on the value of the parameter. If no value is set (ie. Example 1), the link should be based on the pagename of my wiki.
This is what I have so far:
{{#if:{{{wiki1|}}}|[[File:Image1.png|link=w:c:wiki1Name:{{{wiki1}}}]]}}{{#if:{{{wiki2|}}}|[[File:Image2.png|link=w:c:wiki2Name:{{{wiki2}}}]]|}}
At this point, it is properly linking to the appropriate wiki based on the parameters' values (ie. Example 2 works).
Now I need to extend the template to support when no value is added (ie. Example 1). If I understand right, by not including values to the parameters, it's not creating an actual parameter, but instead assigning a value to {{{1}}} and {{{2}}}. So, I'm having trouble incorporating this functionality into what I have. I know it will end up using {{PAGENAME}}.
It also needs to support circumstances where:
- Only one of the parameters is included, ex. {{TemplateName|wiki2}} properly links to w:c:wiki2Name.
- One parameter is set and the other is just included, ex. {{TemplateName|wiki1=PageABC|wiki2}} or vice-versa. Both linking to their correct wiki.