FANDOM


  • I know you can't use pipes in parser functions (like if you want to add a link, you have to use {{!}} instead). I've read no similar information about colons, yet I appear to be having an issue with those and was wondering if there is a similar way to replace them.

    Here is the code I am having issues with:

    {{#switch: rarity
     | common = [[Common_Fish{{!}}Common]]
     | uncommon = [[Uncommon_Fish{{!}}Uncommon]]
     | rare = [[Rare_Fish{{!}}Rare]]
     | legendary = [[Legendary_Fish{{!}}Legendary]]
     | #default = [[Test{{!}}Test]]
    }}
    

    Those links work fine, as long as they point to pages. But the minute I change one (like changing [[Common_Fish{{!}}Common]] to [[Category:Common_Fish{{!}}Common]]), the whole thing stops working.

    A round-about way of fixing this is to create pages for those categories, with a redirect that points to the category, but that seems like an awful messy way to fix this. I was hoping there was some easier solution.

      Loading editor
    • Are you expecting a link to the category to appear? Because right now it ads the category to the page instead. Just asking to eliminate any confusion with
      [[:Category:Common_Fish{{!}}Common]]
      which is a link to the category page itself.
        Loading editor
    • This is code that I use on Aion Wiki and it works just fine:

      {{#switch: {{lc: {{#var: rating}}}}
        |elite     = [[Category:Elite NPCs]]
        |hero      = [[Category:Heroic NPCs]]
        |legendary = [[Category:Legendary NPCs]]
        |normal    = [[Category:Normal NPCs]]
        |#default  = [[Category:NPCs with unknown rating]]
      }}

      Perhaps provide a link to the template itself? That would help in determining the issue.

        Loading editor
    • Ah! Now I feel like an idiot.

      I was forgetting the leading colon. I was using

      [[Category:Common_Fish{{!}}Common]]

      by mistake, which is why it wasn't working.

      Thank you for pointing out the obvious, ha ha. :)

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.