Jump to content

Module:PageLinks/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
created doc, modified from en-wiki version
Tag: Reverted
m Reverted edits by Anachronist (talk) to last version by Zyxw
Tags: Replaced Rollback
Line 1: Line 1:
This module makes {{tl|page-multi}} work, and is modeled on {{tl|user-multi}}. See that template's documentation for more information.
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{lua|Module:PageLinks}}


== Tracking/maintenance category ==
This is a very flexible page link template, which allows you to specify which links are shown beside the pagename. It can be used as a meta-template to support other page link templates, or it can be used alone.
* {{clc|PageLinks transclusions with errors}}

== Usage ==
;Standalone usage
{{pre|1=<nowiki>{{</nowiki>page-multi<nowiki>|</nowiki>''code 1''<nowiki>|</nowiki>''code 2''<nowiki>|</nowiki>''code 3''<nowiki>|</nowiki>...<nowiki>|</nowiki>page=''pagename''<nowiki>}}</nowiki>}}

== Parameters ==
*'''1''', '''2''', '''3''', ... '''n''': these parameters specify what links to display in the template. See the [[#Codes|code table]] below for valid input codes.
*'''page''': the pagename. An error is returned if this is omitted.
*'''separator''': the separator to use in between links. Valid values are <code>dot</code>({{int:dot-separator}}), <code>comma</code>({{int:comma-separator}}), <code>pipe</code>({{int:pipe-separator}}), and <code>tpt-languages</code>({{int:tpt-languages-separator}}). If not specified, then <code>dot</code> is the default.
*'''small''': if this parameter exists, fonts will be displayed at 90% of the normal size.
*'''sup''': if this parameter exists, links will be displayed in superscript.
*'''doc''': this parameter is only available on template pages, using the [[Template:Page-multi/template|/template]] sub-template. If set to <code>yes</code>, it will automatically generate documentation for that template.
*'''date''': if specified, the page view statistics will display for the 30 days prior to the given date (otherwise it's 60 days prior to the current date). The date string should either start with the format YYYY-MM-DD or YYYYMMDD (you can use <code><nowiki>{{subst:CURRENTTIMESTAMP}}</nowiki></code> to insert the current date).
*'''demo''': if this parameter is set to <code>yes</code>, the template will not output any categories.

== Codes ==
Here is a list of currently supported link codes:
{{#invoke:PageLinks|linktable|page=example}}

== Examples ==
{| class="wikitable"
|-
! Code !! Output
|-
| <code><nowiki>{{page-multi|page=Example|t|wlh}}</nowiki></code> || {{page-multi|demo=yes|page=Example|t|wlh}}
|-
| <code><nowiki>{{page-multi|page=Example|wlh|vlm-sgs}}</nowiki></code> || {{page-multi|demo=yes|page=Example|wlh|vlm-sgs}}
|}

== Errors ==
In certain circumstances, the template will generate errors. This is a list of all the error messages that the template might generate, and how users can resolve them.

<!--
Not copied
=== Not a valid language code ===
*<span class="error">[[Template:Page-multi|Page-multi]] error: "xyz" is not a valid language code.</span>

This error is generated if an invalid language code is specified. The language code must be a [[ISO 639-1]] code; for example, English is <code>en</code> and German is <code>de</code>. For a complete list of valid language codes, see the [[:m:List of Wikipedias|List of Wikipedias]].

=== Not a valid interwiki prefix ===
*<span class="error">[[Template:Page-multi|Page-multi]] error: "xyz" is not a valid interwiki prefix.</span>
*<span class="error">[[Template:Page-multi|Page-multi]] error: "ab:cd" is not a valid interwiki prefix.</span>

This error is produced if the template is not able to process the project parameter. The project parameter must either be a valid interwiki prefix, or a valid language code, or in the format "xx:yy" where xx and yy are either valid interwiki prefixes or valid language codes. See [[Help:Interwiki linking]] for a list of valid interwiki prefixes, and the [[#Not a valid language code|section on language code errors]] directly above for more details on valid language codes.

If you are sure that the interwiki prefix is valid, but you still get this error, it might be a bug in the software. This template uses [[Module:InterwikiTable]] for interwiki prefix data, so you can check to see if your site and your prefix exist in the table and fix it if they don't. If that fails to resolve the problem, please start a new thread at [[Template talk:Page-multi]].
-->
=== Not a valid link code ===
*<span class="error">[[Template:Page-multi|Page-multi]] error: "xyz" is not a valid link code.</span>

This error is generated if an invalid link code is specified. For a list of valid link codes, see the [[#Codes|code list]] above.

=== No link type specified ===
*<span class="error">[[Template:Page-multi|Page-multi]] error: no link type specified.</span>

This error is only generated when using [[Module:PageLinks]] directly to create a single link. The link code must be in the first positional parameter, like this: <code><nowiki>{{#invoke:PageLinks|single|<!-- link code -->|<!-- other parameters -->}}</nowiki></code>.

=== Function did not return a string value ===
*<span class="error">[[Template:Page-multi|Page-multi]] error: the function for code "xyz" did not return a string value.</span>

This is an error in the software generating the links, and requires attention from the developers. Please start a new thread at [[Template talk:Page-multi]].

== Tracking categories ==
The template uses the following tracking categories:

;Error category
*[[:Category:PageLinks transclusions with errors]] - this is used to track all the errors listed above

<!--
This functionality was not copied
;Other tracking categories
*[[:Category:PageLinks transclusions with unresolvable interwiki links]]
*[[:Category:PageLinks transclusions with language parameters]]
*[[:Category:PageLinks transclusions with project parameters]]
*[[:Category:PageLinks transclusions with project parameters containing language codes]]
-->
== Adding new links ==
To add a new link, you need to edit the [[WP:Lua|Lua]] module that this template is based on, [[Module:PageLinks]]. Instructions are in the source code, if you feel capable programming in Lua. If you're not familiar with Lua, feel free to make a request on [[Template talk:Page-multi]], and someone might add the link for you.

<!--
== See also ==
* {{tl|User-multi}}
* {{Lm|UserLinks}}
-->

<includeonly>{{Sandbox other||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Modules that add a tracking category]]
}}</includeonly>
}}</includeonly>

Revision as of 03:59, 15 December 2020

This module makes {{page-multi}} work, and is modeled on {{user-multi}}. See that template's documentation for more information.

Tracking/maintenance category