FANDOM


Context-link allows for the creation of context-links templates (brief text providing suggestions for another page for further reading) which can take an infinite number of arguments.

An infinite amount of links and alternative text tied to links can be added through the template, in addition to a desc parameter for the descriptive text and a parameter for additional text. The template also supports adding any extra CSS classes or styles. Links can point to any namespace.

How to install

Context-link is designed to create both individual and standalone templates.

Module

To enable the module on your wiki, simply create a module titled Module:Context-link or otherwise, containing the following:

return require('Dev:Context-link')

CSS

Context-link uses a single CSS class to control its appearance. Add the following code anywhere in your Wikia.css:

.context-link {
   padding-left: 2em;
   font-style: italic;
   margin-bottom: 5px;
}

You can edit as desired to control its appearance.

Parameters

Parameter Inputs Description
desc Short descriptive phrase. Determines the context used in the link template. Defaults to "For another page, see".
<unnamed> Page that should be linked to. All unnamed parameters control links. An infinite number can be taken.
t1-999 Display text for links. Optional parameters. They can replace the text of any link they are attached to, based on its numerical position.
style Any CSS. Optional parameter for adding additional CSS inline styles. This should not be required in most use cases.
class Any class. Optional parameter to add any class. This could be used for any CSS or JavaScript attached to it. It should not be required in most use cases.

Examples

Simple

A simple usage would be:

{{context-link|desc=Main page:|Global Lua Modules}}

results in:

This is all a context-link requires to function.

Multiple arguments

A more complex use goes as follows:

{{context-link|desc=See also:|Global Lua Modules/NavboxBuilder|t1=NavboxBuilder|Global Lua Modules/Quote|t2=Quote|Global Lua Modules/Multiple image|t3=Multiple image}}

results in:

There are many different use cases for multiple arguments being given. Each of these arguments can also have text display attached to it.

However, be aware that in the vast majority of cases, adding text displays to links should be avoided. This is because the name of the article is often descriptive enough.

Styles

If additional styling is desired:

{{context-link|desc=For more information, see|Global Lua Modules/NavboxBuilder|style=color:red}}

results in:

This allows additional control over the appearance of the templates. It is not possible to use style to override link appearances, though it can be possible with the use of the correct class

Once again, this should not be required in the vast majority of cases. A simpler appearance is preferred.

As a template

This is the most common use case.

In the majority of use cases, a context-link with a common set text will be required, with infinite functionality. However, the base template cannot be used to construct context-link templates which share its functionality but have a set description.

Instead, the context-link module should be invoked without the use of the template.

As an example:

{{#invoke:context-link|contextlink|desc=See also:}}

will create a context-link template that can still take infinite arguments and infinite text displays.

This is the most optimal and common use of the context-link module.