Template:Official website/doc: Difference between revisions

From Pantonian Republic Wiki
Jump to navigation Jump to search
 
m (1 revision imported)
 
(No difference)

Latest revision as of 15:16, 28 May 2023

The purpose of this template is to provide a standard format for labeling links to the official website of an article's main topic.

Usage

Basic usage

This template can be used without specifying any parameters, if the "official website" Property (P856) is set in the respective article's Wikidata record. Just add {{official website}} to the article's External links section. If on Wikidata more than one official website is given, the entry tagged with the language being English is automatically preferred.

Advanced usage

Four parameters are available:

Some URLs that contain special characters, such as & or =, will break the template. The solution is to prepend the URL with 1=

Examples

URL in template

To the right of each example is the displayed output. Below each example is the actual output including[span] tags.

  • {{Official website|example.org}}Official website
    <span class="official-website"><span class="url">[http://example.org Official website]</span></span>
  • {{Official website|www.example.org}}Official website
    <span class="official-website"><span class="url">[http://www.example.org Official website]</span></span>
  • {{Official website|//www.example.org}}Official website
    <span class="official-website"><span class="url">[//www.example.org Official website]</span></span>
  • {{Official website|http://www.example.org}}Official website
    <span class="official-website"><span class="url">[http://www.example.org Official website]</span></span>
  • {{Official website|https://www.example.org}}Official website
    <span class="official-website"><span class="url">[https://www.example.org Official website]</span></span>
  • {{Official website|1=https://example.org/?action=view}}Official website
    <span class="official-website"><span class="url">[https://example.org/?action=view Official website]</span></span>
  • {{Official website|https://example.org|name=Example}}Example
    <span class="official-website"><span class="url">[https://example.org Example]</span></span>
  • {{Official website|https://example.org|mobile=https://m.example.org}}Official website (Mobile)
    <span class="official-website"><span class="url">[https://example.org Official website]</span></span> (<span class="url">[https://m.example.org Mobile]</span>)
  • {{Official website|https://example.org|format=flash}}Official website (Requires Adobe Flash Player)
    <span class="official-website"><span class="url">[https://example.org Official website]</span></span> <span style="color:#505050">(Requires [[Adobe Flash Player]])</span>

URL in Wikidata

Usage in the article Amazon (company):

  • {{Official website}}Official website Edit this at Wikidata
    <span class="official-website"><span class="url">[https://www.amazon.com Official website]</span></span> [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/Q3884#P856|Edit this at Wikidata]]

Note: If Wikidata holds two or more values, in different languages, the website in English will be used.

No URL in template or Wikidata

Usage on any page without a URL in Wikidata property (P856):

  • {{Official website}}Lua error in Module:Official_website at line 90: attempt to index field 'wikibase' (a nil value).
    <strong class="error"><span class="scribunto-error" id="mw-scribunto-error-2">Lua error in Module:Official_website at line 90: attempt to index field &#039;wikibase&#039; (a nil value).</span></strong>

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template in articles based on this TemplateData.

TemplateData for Official website

<templatedata> { "description": "This template provides a standard format for labeling links to official websites, stating \"Official website\" with the website linked. If no parameters are set in this template, the template will use the official website entered into Wikidata, if available.", "params": { "1": { "label": "URL", "aliases": [ "url", "URL" ], "description": "Leave this blank if using a URL entered into Wikidata. If there is no Wikidata URL or to override the Wikidata URL, entering a URL in this field will cause the template to link to this entered field. ", "type": "url", "required": false, "default": "Wikidata property P856", "example": "https://example.com" }, "name": { "label": "Replacement Text", "description": "If left blank, the template text will display the words \"Official website\" with the URL linked to it. This field should usually be left blank. If there another webpage that could reasonably understood as the official website and needs to be distinguished from the link in this template, replacement text can displayed by entering it into this field. ", "type": "string", "required": false, "example": "Publisher's website", "default": "Official website", "aliases": [ "2" ] }, "mobile": { "label": "Mobile Website", "description": "If the website has a different 'official website' for mobile devices, this website can be listed here", "type": "string", "required": false, "example": "https://m.example.com" }, "format": { "label": "Requires Flash", "description": "If the website requires Adobe Flash Player software to be displayed, set this parameters value to 'flash'", "type": "string", "required": false, "example": "flash" } }, "paramOrder": [ "1", "name", "mobile", "format" ] } </templatedata>

Tracking categories

One of the following categories may be added to articles using this template (via Module:Official website):

See also

  • {{Official URL}} – For inserting the official link itself as opposed to its name. Useful for Infoboxes.