Template:Link/Desc

From PCSAR

Revision as of 05:57, 18 September 2015 by Brett Wuth (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

This is the documentation for the template Template:Link/Desc

Template:Link/Desc/Doc:
Related Templates
Link/Create Create from template
Link/Desc Use page's description
Link/Create+Desc Combine Link/Create and Link/Desc
Link Default; same as Link/Desc

This template creates a link to another wiki page.

Contents

[edit] Common usage

Most commonly this template is called as {{link|Page}}. In the form {{link|Page|Text}} it creates a link to Page but displays the link as Text.


You type... You get...
{{link|Main Page}} 
Main Page
{{link|Main Page|see this page}} 
see this page


It is also commonly used to provide links to file descriptor pages. See Help:Linking to files.

You type... You get...
{{link|Image:Demo Sunflower.png}} 
Image:Demo Sunflower.png


{{link}} is an alternative shortened name for {{Link/Desc}}. Either can be used.

[edit] Features

This template is similar to creating a link with double square brackets: [[Page]].

Double square brackets requires extra decoration with a leading colon when the page is an Image:, File: or Category:. This template handles those types of pages without any extra work; no leading colon is necessary.

If no Text is provided, the link is shown as the Page name. For subpages (e.g. Main Topic/subtopic) the link text is just the subtopic.

The page can have a description and that description will be displayed as the text of the link. The description is taken from the Property:Page description which can be set using Template:desc, etc.

The link can lead to a previous version of a wiki page, using the parameter RevisionID.

For multipage PDF's the link can lead to a specific page, using the parameter PageNum.

As Template:Link/Create or Template:Link/Create+Desc, links to pages that don't exist yet can specify default text for their creation.

[edit] Parameters

The template {{Link/Desc|Page|RevisionID=id|PageNum=number|Text|Desc=description}} uses the following parameters:

Page 
the page to link to
RevisionID 
(optional) The revision to link to. This is used to link to an old version of an existing page. Revision ID's can be found on the "history" tab of the page in question, as "oldid". Revision ID's are unique across all pages, so the Revision ID also specifies the Page. If the Revision ID is provided, the Page does not need to be specified unless it is to provide the link text.
PageNum 
(optional) if Page is a file that supports multiple internal pages, this parameter will link to the specified internal page
Text 
(optional) the text to display as the link
Desc 
(optional) the text to display as the link if the page does not have a description and Text is not supplied. There is no point to specifying both Text and Desc.

[edit] Examples

For illustration purpose, the following demonstration pages have been set up:


You type... You get...
{{Link/Desc|Demo/Page with description}} 
Described page
{{Link/Desc|Demo/Page without description}} 
Page without description
{{Link/Desc|Demo/Page with description|this page}} 
this page
{{Link/Desc|Demo/Page without description|this page}} 
this page


Here's how it would work if you had used square brackets instead. (The difference between this table and the previous one is only in the first case.)

You type... You get...
[[Demo/Page with description]] 
Demo/Page with description
[[Demo/Page without description]] 
Demo/Page without description
[[Demo/Page with description|this page]] 
this page
[[Demo/Page without description|this page]] 
this page


Using Desc:

You type... You get...
{{Link/Desc|Demo/Page with description|Desc=this page}} 
Described page
{{Link/Desc|Demo/Page without description|Desc=this page}} 
this page
{{Link/Desc|Demo/Page with description|That Page|Desc=this page}} 
That Page
{{Link/Desc|Demo/Page without description|That Page|Desc=this page}} 
That Page


Using RevisionID:

You type... You get...
{{Link/Desc|RevisionID=1}} 
linklink=
{{Link/Desc|Main Page|RevisionID=1}} 
Main Pagelink=
{{Link/Desc|Main Page|main|RevisionID=1}} 
mainlink=


Using PageNum:

You type... You get...
{{Link/Desc|Main Page|PageNum=2}} 
Main Page


[edit] Implementation

Helper templates:

Icons:


To see how this template is implemented, edit this page and examine the portion between <includeonly> and </includeonly>.

Personal tools