User blog:AgentMuffin/List template

=TECHNICAL TIME= Here's an easier way to link to a list.

As any wikitext user worth their salt will tell you, you can link to a page via keyword by using a piped link. So to link the word "video" to List of videos, for example, you'd type  video , which would result in the link "video". However, I find this repetitious and unwieldy.

So what did I do? I made a template, of course!

The template can be found at Template:List, and of course can be used by typing  . Pipe the template and use the string "video" as the first parameter, like so:  . When you publish the page, the template will link to List of videos via a link reading "video". It looks like this:. Handy, isn't it?

You can also pipe the template again and add "s" as the second parameter, resulting in  . This will pluralize the anchor text, but not the name of the link's target. In other words, the link displays "videos" instead of "video"; however, it links to List of videos, not List of videoss. Try it and you'll get this as the result:.

How does it work? The code is very simple, and you may have figured it out already:  List of s . In layman's terms, it's a link to an article named "List of ____s". The first parameter fills in that blank. After the pipe, that very same first parameter also fills in the text displayed on screen. After that is a function to check whether anything is in the second parameter. If there is, "s" is placed after the contents of the first parameter. If the second parameter is left blank, nothing extra is displayed.

Now,   is just an example. You can fill in the blank in "List of ____s" with any string, but preferably one that will make a link to an existing page!  ˜ AgentMuffin ”