Forum:Filtered Whatlinkshere Results

From Drunkapedia
Revision as of 10:00, 15 October 2009 by imported>Tlosk's Bot (Created page with '{{Forumheader|General}} <!-- Please put your content under this line. Be sure to sign your edits with four tildes: ~~~~ --> {{Post | Indent = : | Text = For a while now I've …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Forums: Index
General
Forum:Filtered Whatlinkshere Results


For a while now I've been trying to figure out a way to get more specific Whatlinkshere results, ideally we could filter results by category however I've been unable to discover any way of doing that currently. I have however come up with a partial solution for at least some types of items that would be easy to implement and could be changed if needed without lots of cleanup edits.

I realized that it's possible to make invisible links on pages (a link that isn't actually displayed, but will cause the page to show up in the whatlinkshere list) and that you can also have a whatlinkshere link to a nonexistent page, which allows us to specify a page for a specific type of links we want to filter for (just Shopkeepers, just Creatures, just Locations, etc).

These special links can automatically be included in component templates. For example, to get a list of just shopkeepers that sell a particular item, we can place this: [[{{PAGENAME}}/Sold By|<nowiki></nowiki>]] inside the {{Inventory Item}} template since it is only used on Shopkeeper pages. This would automatically create a link to each item for that shopkeeper of the format Item/Sold By which would then be used in the {{Sold By}} template which would be modified from a straight whatlinkshere link to [[:Special:Whatlinkshere/{{PAGENAME}}/Sold By]]. So instead of including all links (like recipes and patch pages etc, it would only list shopkeepers.

I was trying to think what else we could use this for and so far I've come up with:

  • Items included in recipes.
  • Creature locations (I will need to make a component template for creature lists that will be closer to item lists). (I'm leaning towards being able to specify the type of location as well, so we could get separate lists for dungeons and landscape locations).
  • Trophies (may not be possible without changing the template in a significant way).

Are there any other ones that would be good to include? Also input on whether to include this for just item types that generate big lists and skip smaller ones that could be ready through quickly, or to do this for them all.--Tlosk 11:17, 10 May 2009 (CDT)

That's a very clever solution. I was going to suggest looking at the Semantic MediaWiki extension, but it appears that it doesn't support to-many relationships (like the shopkeeper selling multiple items). --Widgeon 17:29, 11 May 2009 (CDT)

I'm not sure I understand exactly how this will work, but if you say we can just modify the templates and it will work, then it sounds good to me. I agree with the things you listed. I would divide creatures into 3 types instead of 2: Dungeons, POIs, and general landscape - the listings found in Geographic Area and Town pages. --An Adventurer 18:10, 11 May 2009 (CDT)

Yeah it's kind of convoluted, but thankfully the implementation is transparent and a poster doesn't have to do anything different. However once implemented it will break existing vendor/recipe links so I'm going to wait until we finish updating existing entries with the new templates to turn the key so to speak (in the meantime we'll just get the full list of links like normal).

But so you can see it in action, here's a hardcoded example:

Old style (all links) for Stout: This item is sold by one or more shopkeepers.

New style (just shopkeepers) for Stout: This item is sold by one or more shopkeepers.

This first one finds all pages that link to "Stout," but the second one just the pages that link to "Stout/Sold By" and that's only the pages using the new shopkeeper template.

--Tlosk 20:11, 11 May 2009 (CDT)