FANDOM


  • So what I'm trying to do is create a {{DISPLAYTITLE}}-like effect inside an infobox, but strictly for subpages when the title parameter is filled in. Some friends told me to use {{SUBPAGENAME}} inside the actual template's code but it doesn't give the results that I'm looking for (it does somewhat work if used on normal pages and not inside the code). I've been googling for examples or easy-to-comprehend examples or explanations, but no luck.

    I really don't want to manually place said magic words on every separate page, just for the sake of convenience, so is there a way to do this? And can I also do something similar to sub-subpages? I don't mind having to use {{DISPLAYTITLE}} or {{SUBPAGENAME}}, it's just inconvenient having to plop those in on every subpage. Thanks :)

    To be specific, this template is what I'm having issues with: [1] ; this subpage is what I'm using for reference after editing the infobox to see results: [2]. In this case I just want the page's title and infobox title to appear as "The Sweeper", and not "Epic Minigames/The Sweeper", when the title parameter is filled in. The solution should hopefully carry over to other subpages, i.e. if the title parameter is filled in a template placed on the subpage "Epic Minigames/Colossal Assault" with "Colossal Assault", then the title of the page and the infobox should say "Colossal Assault". I know using {{DISPLAYTITLE:The Sweeper}} or {{DISPLAYTITLE:Colossal Assault}} will provide what I am looking for, but I think it's just overall better not just for me but for future editors if I can get a template to just automate that + the infobox name. Any tips would be very helpful! Sorry if any of this didn't make sense lol

      Loading editor
    • try titleparts. something like {{displaytitle:{{#titleparts:{{pagename}}|1|-1}}}}

        Loading editor
    • Just to be sure we're all on the same page as far as terminology is concerned…

      • "info box name" is the name of the infobox template being called for on the page, i.e., "charbox" for characters. This calls the *type* of infobox on many similar pages
      • then there is a "title field" in the infobox which puts words at the top of an infobox, i.e., "Kim Possible", also not to be confused with such things as "full name=" which can be different from the box's Title
      • A page/subpage can can be inserted into a field (title or the like) by use of MagicWords {{PAGENAME}} (the complete name of the current page), {{BASEPAGENAME}}, amd {{SUBPAGENAME}}, any of which commands will fill lines in the infobox and or main article controlled by the name of the Page. Using your example, ON "Epic Minigames/Colossal Assault", the following MagicWords (ignoring brackets for this example) will return:
        • PAGENAME = Epic Minigames/Colossal Assault
        • BASEPAGENAME = Epic Minigames
        • SUBPAGENAME = Colossal Assault
      • DISPLAYTITLE controls how the big words at the very top of the page appear. Often used for things like "iPod" when WikiMedia OS always caps the first letter, "IPod"

      Any of this help?

        Loading editor
    • To add to my post…

      DISPLAYTITLE for your example "Epic Minigames/Colossal Assault" can be setup like so: {{DISPLAYTITLE:{{SUBPAGENAME}}}} (note how each element has to have its own closing brackets, hella important) which will return Colossal Assault for the displayed pagename. You can even Italicize it by adding the appropriate two single-hashmarks like so, {{DISPLAYTITLE:''{{SUBPAGENAME}}''}} to return Colossal Assault. But don't bother with BOLD as it's already bold.

      This works for the entire SUBPAGENAME, but if you wish to Italicize only part of the DISPLAYTITLE:SUBPAGENAME, that is where you'll need to look into titleparts.

        Loading editor
    • To Fngplg, thanks I'll check out titleparts and mess with those, didn't know that existed!

      To Love Robin, thank you but I am aware of how all of that works. What I was asking for was if there was a way to automatically name both the "big words at the very top of the page" and the title of the infobox if something is placed in the source code of an infobox, not on an article page. (Maybe this was answered and I'm just not reading closely enough.)

      I don't know if this is something that can be done in vanilla MW (the one Fandom/Wikia uses) or if I need to have a custom module or anything else. As said before, I don't mind having to place the magic words manually on each subpage but it can be tedious and I just want to have a faster workflow not just for me but for all editors on the wiki wherever possible.

        Loading editor
    • Well, BEFORE you can add infoboxes with or without coding, you NAME THE PAGE. That's the chicken before the egg. So all you need is to properly code your infoboxes to use one of the PAGENAME MagicWords.

        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.