FANDOM


  • So recently I made a template on the Top Gear wiki which deals with pages that contain information exclusive to The Grand Tour, a show which is not officially affiliated to Top Gear or the BBC in any way. What it says is that the page exists simply for contextual reasons, and that a longer, more detailed article is available on the Grand Tour wiki.

    What I want to know is if a certain string is detected at the end of a page name (i.e. TGT), it is removed when linking to its corresponding article. So for example, I have The Eboladrome (TGT), which at the moment links to an identically named page which of course, doesn't exist, since it doesn't have the "(TGT)" suffix applied. Granted I could create redirects on The Grand Tour wiki or rename the pages so that they match, but surely there has to be a way for this to work with just pure string manipulation, that detects if a "(TGT)" string is present and removes it.

      Loading editor
    • Hey there! You can try use StringFunctions for this. In particular, you can substitute all " (TGT)" out, like this:

      {{#replace:{{PAGENAME}}| (TGT)|}}

      For example, the link in the template would be:

      [[w:c:thegrandtour:{{#replace:{{PAGENAME}}| (TGT)|}}|The Grand Tour Wiki/{{#replace:{{PAGENAME}}| (TGT)|}}]]

      Try it out!

      I think it may be better to also adjust the template to accept one extra parameter, so that it is better linked. Like - your Eboladrome example still doesn't work because the equivalent page doesn't that 'The', so maybe you can tweak the template so that it accepts the equivalent pagename on the TGT wiki:

      {{TGT Notice|Eboladrome}}
      
        Loading editor
    • Hey there, first time I've been able to check due to personal problems outside Fandom/Wikia, and it seems to work great. Fits my¬†intended purpose exactly.

      For pages that aren't named the same, I think there is some degree of simple renaming/redirecting involved, but on the whole this has saved a lot of inefficient changes. Thanks very much for your assistance.

        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.