Difference between revisions of "Template:Facebook/doc"

From blackwiki
Jump to navigation Jump to search
(→‎Examples: update/fix)
imported>Zyxw
m (→‎Tracking category: update link)
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
+
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{warning|The [[Wikipedia:External links|external links guideline]] recommends [[WP:ELNO|avoiding links to Facebook]] unless the profile is an [[WP:ELOFFICIAL|official account]], "controlled by the subject (organization or individual person) of the Wikipedia article" '''and''' when the links to Facebook "provide the reader with unique content and are not prominently linked from other official websites".  Wikipedia is not a directory for helping Facebook users find pages on Facebook.}}
+
{{Warning|The [[Wikipedia:External links|external links guideline]] recommends [[WP:ELNO|avoiding links to Facebook]] unless the profile is an [[WP:ELOFFICIAL|official account]], "controlled by the subject (organization or individual person) of the Wikipedia article" '''and''' when the links to Facebook "provide the reader with unique content and are not prominently linked from other official websites".  Wikipedia is not a directory for helping Facebook users find pages on Facebook.}}
 +
{{Uses Wikidata|P2013}}
 +
{{Lua|Module:EditAtWikidata}}
 +
{{See also|Template:Facebook page|Wikipedia:External links/Perennial websites}}
 +
 
 +
'''{{NAMESPACE}}:{{BASEPAGENAME}}''' displays an external link to a page at [[Facebook]], a [[social networking]] website. It is intended for use in the [[Wikipedia:External links|external links]] section of an article.
 +
__TOC__
 +
{{clear}}
  
 
==Usage==
 
==Usage==
{{See also|Wikipedia:External links/Perennial websites}}
+
; Unnamed parameters
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''user name or number'' }}</code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | ''user name or number'' | ''Displayed Name'' }}</code>
 +
 
 +
; Named parameters
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''user name or number'' }}</code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | id= ''user name or number'' | name= ''Displayed Name'' }}</code>
 +
 
 +
; Using [[Wikidata]] property ''{{Property|P2013}}''
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: <code><nowiki>{{</nowiki>{{BASEPAGENAME}} | name= ''Displayed Name'' }}</code>
 +
 
 +
== Examples ==
 +
 
 +
=== Linking to a profile or page ===
 +
In this example, the Facebook user name is ''zuck'' and the [[link text]] is ''Mark Zuckerberg'':
 +
 
 +
: <samp>https://<nowiki/>www.facebook.com/{{Hilite|zuck}}</samp>
 +
: <code><nowiki>* {{Facebook | zuck | Mark Zuckerberg }}</nowiki></code>
 +
:* {{{{BASEPAGENAME}} | zuck | Mark Zuckerberg }}
 +
 
 +
In this example, there is a Facebook user number instead of a user name:
 +
 
 +
: <samp>https://<nowiki/>www.facebook.com/{{Hilite|4}}</samp>
 +
: <code><nowiki>* {{</nowiki>{{BASEPAGENAME}} |id= 4 |name= Mark Zuckerberg }}</code>
 +
:* {{{{BASEPAGENAME}} |id= 4 |name= Mark Zuckerberg }}
 +
 
 +
On the article about an individual, the display name and the article title will usually be identical and can be omitted. For example, on the article page [[Facebook]], linking to their own Facebook profile could be done with:
 +
 
 +
: <samp>https://<nowiki/>www.facebook.com/{{Hilite|facebook}}</samp>
 +
: <code><nowiki>* {{</nowiki>{{BASEPAGENAME}} | facebook }}</code>
 +
:* {{{{BASEPAGENAME}} | facebook }}
 +
 
 +
=== Linking to a specific section ===
 +
Links to specific sections on a Facebook page used to include the '=' symbol in the URL but no longer need to. Because '=' is a special character in Wikipedia template syntax (which separates a parameter's name from its value), it cannot be used directly in the id. If you want the link to arrive at a specific section, use the newer URL syntax, for example to link directly to the Photos section of a profile, add <code>/photos</code> to the username:
 +
 
 +
: <samp>https://<nowiki/>www.facebook.com/{{Hilite|zuck/photos}}</samp>
 +
: <code><nowiki>* {{</nowiki>{{BASEPAGENAME}}|zuck/photos|name=Mark Zuckerberg}}</code>
 +
:* {{{{BASEPAGENAME}}|zuck/photos|name=Mark Zuckerberg}}
 +
 
 +
=== Using Wikidata ===
 +
Generally, [[Wikidata]] should contain article subjects' Facebook IDs in property {{Property|P2013}}, allowing the ID parameter to be omitted:
 +
: <code><nowiki>* {{</nowiki>{{BASEPAGENAME}}<nowiki>}}</nowiki></code>
 +
: <code><nowiki>* {{</nowiki>{{BASEPAGENAME}} |name=''NAME'' }}</code>
 +
 
 +
If the Wikidata property is not defined, the output is:
 +
:* {{ {{BASEPAGENAME}} }}
  
 
== TemplateData ==
 
== TemplateData ==
Line 14: Line 67:
 
         "id": {
 
         "id": {
 
             "label": "Account ID",
 
             "label": "Account ID",
             "description": "ID of the Facebook account (part of the web page address, for www.facebook.com/example/ the account id is \"example\").",
+
            "aliases": ["1"],
 +
             "description": "ID of the Facebook account (part of the web page address, for www.facebook.com/example/ the account id is \"example\"). This parameter is optional if Wikidata property P2013 exists, but required if not.",
 
             "type": "string/line",
 
             "type": "string/line",
             "required": true,
+
             "required": false,
             "aliases": ["1"]
+
             "default": "Wikidata property P2013"
 
         },
 
         },
 
         "name": {
 
         "name": {
 
             "label": "Display name",
 
             "label": "Display name",
 +
            "aliases": ["2"],
 
             "description": "Display name for the Facebook account",
 
             "description": "Display name for the Facebook account",
 
             "type": "string/line",
 
             "type": "string/line",
 
             "required": false,
 
             "required": false,
             "default": "Name of the page",
+
             "default": "Name of the page"
            "aliases": ["2"]
 
 
         }
 
         }
 
     }
 
     }
Line 31: Line 85:
 
</templatedata>
 
</templatedata>
  
== Examples ==
+
== Tracking category ==
In this example, the Facebook user account is ''markzuckerberg'' and the description in the link is ''Mark Zuckerberg'':
+
* {{clc|Facebook template missing ID and not in Wikidata}}
  <nowiki>{{Facebook|markzuckerberg|Mark Zuckerberg}}</nowiki>
 
{{Facebook|markzuckerberg|Mark Zuckerberg}}
 
 
 
In this example, there's an ID instead of user name:
 
  <nowiki>{{Facebook|id=markzuckerberg/4|name=Mark Zuckerberg}}</nowiki>
 
{{Facebook|id=markzuckerberg/4|name=Mark Zuckerberg}}
 
 
 
===Links containing the {{=}} sign===
 
Links to specific sections on a Facebook page may include the '=' symbol in the URL. For example, the string '?v=wall' would indicate the "Wall" section. Because '=' is a special character in Wikipedia template syntax (which separates a parameter's name from its value), it cannot be used directly in the id. If you want the link to arrive at a specific section, use [[Template:=]] instead. For example, to link to the "Notes" section:
 
 
 
  <nowiki>{{Facebook|id=markzuckerberg/4?v{{=}}notes|name=Mark Zuckerberg}}</nowiki>
 
{{Facebook|id=markzuckerberg/4?v{{=}}notes|name=Mark Zuckerberg}}
 
  
==See also==
+
== See also ==
* [[Template:Facebook Page]]
+
* {{tl|Facebook page}} which uses Wikidata property ''{{property|P4003}}''
 
* [[Wikipedia:FACEBOOK]]
 
* [[Wikipedia:FACEBOOK]]
 
* {{tl|Facebook navbox}}
 
* {{tl|Facebook navbox}}
* {{tl|Google+}}
 
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
+
<includeonly>{{Sandbox other||
 
<!-- Categories below this line, please; interwikis at Wikidata -->
 
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Social media external link templates|{{PAGENAME}}]]
+
[[Category:Social media external link templates]]
 +
[[Category:External link templates using Wikidata]]
 +
[[Category:Templates that add a tracking category]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 17:56, 10 May 2020

Template:Uses Wikidata

Template:Facebook displays an external link to a page at Facebook, a social networking website. It is intended for use in the external links section of an article.

Usage

Unnamed parameters
{{Facebook | user name or number }}
{{Facebook | user name or number | Displayed Name }}
Named parameters
{{Facebook | id= user name or number }}
{{Facebook | id= user name or number | name= Displayed Name }}
Using Wikidata property Template:Property
{{Facebook}}
{{Facebook | name= Displayed Name }}

Examples

Linking to a profile or page

In this example, the Facebook user name is zuck and the link text is Mark Zuckerberg:

https://www.facebook.com/zuck
* {{Facebook | zuck | Mark Zuckerberg }}

In this example, there is a Facebook user number instead of a user name:

https://www.facebook.com/4
* {{Facebook |id= 4 |name= Mark Zuckerberg }}

On the article about an individual, the display name and the article title will usually be identical and can be omitted. For example, on the article page Facebook, linking to their own Facebook profile could be done with:

https://www.facebook.com/facebook
* {{Facebook | facebook }}

Linking to a specific section

Links to specific sections on a Facebook page used to include the '=' symbol in the URL but no longer need to. Because '=' is a special character in Wikipedia template syntax (which separates a parameter's name from its value), it cannot be used directly in the id. If you want the link to arrive at a specific section, use the newer URL syntax, for example to link directly to the Photos section of a profile, add /photos to the username:

https://www.facebook.com/zuck/photos
* {{Facebook|zuck/photos|name=Mark Zuckerberg}}

Using Wikidata

Generally, Wikidata should contain article subjects' Facebook IDs in property Template:Property, allowing the ID parameter to be omitted:

* {{Facebook}}
* {{Facebook |name=NAME }}

If the Wikidata property is not defined, the output is:

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Facebook

Generate a link to a Facebook profile in a standard format.

Template parameters

ParameterDescriptionTypeStatus
Account IDid 1

ID of the Facebook account (part of the web page address, for www.facebook.com/example/ the account id is "example"). This parameter is optional if Wikidata property P2013 exists, but required if not.

Default
Wikidata property P2013
Lineoptional
Display namename 2

Display name for the Facebook account

Default
Name of the page
Lineoptional

Tracking category

See also