Template talk:Wikidata entity link
This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
Rename
editThis template will give links to items and properties. With that in mind, is there a better name for it? — Martin (MSGJ · talk) 10:49, 18 September 2015 (UTC)
- Suggest Template:Wikidata entity link — Martin (MSGJ · talk) 11:53, 21 September 2015 (UTC)
- Done — Martin (MSGJ · talk) 13:56, 23 September 2015 (UTC)
- I am not sure how I feel about this. Template:Q at least should always redirect here. Blue Rasberry (talk) 14:04, 23 September 2015 (UTC)
- It does and it will :) — Martin (MSGJ · talk) 15:40, 23 September 2015 (UTC)
- I am not sure how I feel about this. Template:Q at least should always redirect here. Blue Rasberry (talk) 14:04, 23 September 2015 (UTC)
- Done — Martin (MSGJ · talk) 13:56, 23 September 2015 (UTC)
Matching property template
editIs there a matching property template on English Wikipedia? Pigsonthewing, do you know? Blue Rasberry (talk) 21:47, 3 December 2015 (UTC)
- This will do both. I've added an example to the documentation. — Martin (MSGJ · talk) 21:52, 3 December 2015 (UTC)
- Oh! Thanks. Blue Rasberry (talk) 21:54, 3 December 2015 (UTC)
Generating Wikilinks from Wikidata
editIs there a template that produces a link to the relevant Wikipedia article if you enter the Wikidata item? i.e. Q666063 would produce National Library of Wales instead of National Library of Wales (Q666063) and Q17735890 would produce Old College instead of Old College (Q17735890). I'm translating a long list of links from English into Welsh for Wikipedia:WikiProject Wales/Awaken the Dragon but most of the Welsh translations already exist on Wikidata. Ham II (talk) 09:47, 12 February 2016 (UTC)
- Ham II, This does seem like it would be useful at times. I noticed that Spanish Wikipedia seems to have such a template, es:Plantilla:Q obra. I don't know if the Lua syntax could simply be carried over. Rigadoun (talk) 23:43, 27 February 2018 (UTC)
- Hi Ham II and Rigadoun. This can be done with
{{wikidata|label|linked|Q...}}
:{{wikidata|label|linked|Q666063}}
--> National Library of Wales{{wikidata|label|linked|Q17735890}}
--> Old College
- I believe Template:LinkedLabel ought to provide this functionality in a more convenient way, which would also match the Wikidata equivalent, but it seems to produce an edit link, for some reason. Pinging its creator D1gggg for further commentary. --Waldir talk 12:23, 5 June 2018 (UTC)
- Hi Ham II and Rigadoun. This can be done with
Link format
editWhy does this template generate links as external links, when Wikilinks should work perfectly well? For instance, {{q|42}}
emits
[https://www.wikidata.org/wiki/Special:EntityPage/Q42 Douglas Adams <small>(Q42)</small>]
which looks like this: Douglas Adams (Q42)
But it could yield
[[d:Q42|Douglas Adams <small>(Q42)</small>]]
which looks like this Douglas Adams (Q42)
I'm no Lua expert, but surely this would be possible. --Redrose64 🌹 (talk) 22:05, 6 February 2018 (UTC)
- Ask 50.53.1.33 (talk · contribs · WHOIS) -- no wait, they haven't edited since October. {{3x|p}}ery (talk) 23:00, 7 February 2018 (UTC)
- It uses Module:Wikibase function wdurl. Indeed it should better generate interwiki links! --Marsupium (talk) 11:10, 18 May 2018 (UTC)
- This template did generate interwiki links as shown above until 7 September 2017 it was changed to generate external links using {{#invoke:Wikibase|wdurl}}. I have updated the template so it displays interwiki links again, while also retaining the other functionality that was added to use the template without a parameter (as shown in the template's updated documentation). -- Zyxw (talk) 03:18, 19 January 2019 (UTC)
- Thank you --Redrose64 🌹 (talk) 16:46, 19 January 2019 (UTC)
- What exactly is the benefit of using interwiki links over external links or vice versa? Aren't external links easier to search for? It looks like this was using mw.wikibase.getEntityUrl (via {{#invoke:Wikibase|wdurl}} as mentioned before). Also this template is named "Wikidata entity link" but it does not link to the entity but to its data description (You can learn about the difference at Linked Data interface and Wikidata identifiers). We should probably link to either the real entity link (via https://www.wikidata.org/entity/ ; notice this cannot be reached via interwiki links) or use the entity data link d:Special:EntityData/, e.g., https://www.wikidata.org/entity/P31 or d:Special:EntityData/P31. Notice prefixes like "Property:" and "Lexeme:" are not necessary in these cases. It should also be noted that the current template does not handle all entity types, e.g.,
{{Wikidata entity link|L3}}
fails to properly link to d:Special:EntityData/L3 (I am not sure this matters yet as lexeme entities do not have labels for such links anyway but it should be something to think about). 17.226.15.91 (talk) 01:18, 21 June 2019 (UTC)
- What exactly is the benefit of using interwiki links over external links or vice versa? Aren't external links easier to search for? It looks like this was using mw.wikibase.getEntityUrl (via {{#invoke:Wikibase|wdurl}} as mentioned before). Also this template is named "Wikidata entity link" but it does not link to the entity but to its data description (You can learn about the difference at Linked Data interface and Wikidata identifiers). We should probably link to either the real entity link (via https://www.wikidata.org/entity/ ; notice this cannot be reached via interwiki links) or use the entity data link d:Special:EntityData/, e.g., https://www.wikidata.org/entity/P31 or d:Special:EntityData/P31. Notice prefixes like "Property:" and "Lexeme:" are not necessary in these cases. It should also be noted that the current template does not handle all entity types, e.g.,
- Thank you --Redrose64 🌹 (talk) 16:46, 19 January 2019 (UTC)
Wikilink to the French article?
editWhen I know the QID, can I link to the French article via WD, automatically?
- On enwiki:
- Douglas Adams == Douglas Adams (Q42)
- Then
{{some template or module|lang=fr|qid=Q42}}
→ fr:Douglas Adams - ... and zh:道格拉斯·亚当斯
-DePiep (talk) 18:01, 28 October 2020 (UTC)
- This obviously will only work if there are appropriate sitelinks for associated Wikidata item but methinks you are looking for: d:Special:GoToLinkedPage/frwiki/Q42 and d:Special:GoToLinkedPage/zhwiki/Q42 —Uzume (talk) 20:57, 2 November 2020 (UTC)
- good for me. -DePiep (talk) 21:04, 2 November 2020 (UTC)
- This obviously will only work if there are appropriate sitelinks for associated Wikidata item but methinks you are looking for: d:Special:GoToLinkedPage/frwiki/Q42 and d:Special:GoToLinkedPage/zhwiki/Q42 —Uzume (talk) 20:57, 2 November 2020 (UTC)
Removing Wikidata entity link
editSomeone is massively removing enwiki code using this template, eg https://en.wiki.x.io/w/index.php?title=Corumb%C3%A1_International_Airport&oldid=1041289573&diff=prev Is there clear enwiki rule to ban Wikidata entity link inside an article ? Bouzinac (talk) 19:24, 29 August 2021 (UTC)
- As I said in my edit summary, Wikipedia talk:Manual of Style/Archive 204#New RFC on linking to Wikidata is the
clear enwiki rule
you are looking for. The claim you keep making thatthat RfC [is] without clear conclusions
(quote from Wikipedia:Village pump (idea lab)#Create template/link for things that have Wikidata items, but not articles) is wishful thinking unsupported by the actual closing statement of the RfC. * Pppery * it has begun... 15:18, 30 August 2021 (UTC) - Wikipedia:Wikidata#Appropriate usage in articles - specifically this point: "Wikidata should not be linked to within the body of the article except in the manner of hidden comment(s) as to mentioning the Q-number." 192.76.8.74 (talk) 16:51, 30 August 2021 (UTC)
Add title parameter?
editI was thinking it would be nice if a second parameter could be added to this template, allowing users to choose label text for the link. For example, {{Wikidata entity link|1=Q42|2=Information about Douglas Adams on Wikidata <small>(Q42)</small>}}
would yield something like this: Information about Douglas Adams on Wikidata (Q42). Thoughts?
Edward-Woodrow (talk) 00:40, 22 May 2023 (UTC)
Not picking up mul labels from Wikidata entities
editAs of 2024 at roughly 14:00 UTC, the following
*[[Douglas Adams]], {{Wikidata entity link|Q42}}, [https://elmcip.net/node/4796 4796]
is producing
Here it is in {{tq}} in case it is rectified:
Douglas Adams, (Q42), 4796
The entity label is not being returned. This is apparently because of the switch to mul
labels & the blanking of labels.
Please see wikidata:Help:Default values for labels and aliases. Peaceray (talk) 14:14, 29 August 2024 (UTC)
- @John Vandenberg, MSGJ, Zyxw, and Uzume: Would one of you please help with this?
- When the
Label
value for EnglishLanguage
is blank, then his should be attempting to retrieve theLabel
value for default for all languagesLanguage
. See what is there for English & default for all languages for Q42. Peaceray (talk) 23:26, 29 August 2024 (UTC)
- This template uses Module:Wd to get the entity label from Wikidata:
- {{#invoke:wd|label|Q1}} → Universe
- {{#invoke:wd|label|Q42}} → Douglas Adams
- The best solution would be if Module:Wd was updated to use the default label when there is no English label. -- Zyxw (talk) 00:24, 30 August 2024 (UTC)
- Who can do that? I am not exactly a Lua coder.
- @Uzume: It looks like you have edited Module:Wd. Would you be able to take care of this change? Peaceray (talk) 01:04, 30 August 2024 (UTC)
- @Janhrach maintains that module — Martin (MSGJ · talk) 05:55, 30 August 2024 (UTC)
- @Peaceray: I personally would prefer moving to a solution based upon Module:Wikidata label (Q22050722) which does not have this problem (unless one specifies a specific language and then it does not fallback to mul). This is what Wikidata, Commons, Mediawiki and even Meta (sadly despite using that module to obtain the label this template messed up and it does not fallback to using mul there forcing label lookups to default to the page language) use and why they to not see this issue for this template (except Meta as previously commented on). The problem is many Wikidata modules (like Module:Wd (Q24733825)) think they are doing you a service by fetching a specific language label using
mw.wikibase.getLabelByLang()
instead of using a different interface that implements proper language fallbacks, seemw.wikibase
API. For this issue you can clearly see the issue at Module:Wd#L-704 (in particular see the comment). —Uzume (talk) 13:58, 30 August 2024 (UTC)- Reviewing... will respond Later. Peaceray (talk) 22:09, 30 August 2024 (UTC)
- @Peaceray: I personally would prefer moving to a solution based upon Module:Wikidata label (Q22050722) which does not have this problem (unless one specifies a specific language and then it does not fallback to mul). This is what Wikidata, Commons, Mediawiki and even Meta (sadly despite using that module to obtain the label this template messed up and it does not fallback to using mul there forcing label lookups to default to the page language) use and why they to not see this issue for this template (except Meta as previously commented on). The problem is many Wikidata modules (like Module:Wd (Q24733825)) think they are doing you a service by fetching a specific language label using
- @Janhrach maintains that module — Martin (MSGJ · talk) 05:55, 30 August 2024 (UTC)
- @Uzume: It looks like you have edited Module:Wd. Would you be able to take care of this change? Peaceray (talk) 01:04, 30 August 2024 (UTC)
- Janhrach (talk) 18:32, 12 September 2024 (UTC)Resolved
Displaying descriptions
editIt would be useful if the output of this template append to the title attribute the description from Wikidata. For example for Birmingham (Q2256), that would (at the time of writing) render as "d:Special:EntityPage/Q2256 - city in West Midlands, England
" (maybe we could drop the "d:Special:EntityPage/
" part?). This would be useful for disambiguating the target from others with the same title, such as in my example, Birmingham, Alabama. The same should be done for properties (e.g. ORCID iD (P496))). Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 13:21, 1 September 2024 (UTC)
- I disagree. I don't think it is good to complicate a simple template with a well-defined scope. The displayed QID and the linked entity are, in my opinion, a sufficient disambiguators. Of course, a separate template with the behavior you described could be created. Janhrach (talk) 18:35, 12 September 2024 (UTC)
- @Janhrach: I think Andy means he wants
{{wde|Q2256}}
to display more like Birmingham (Q2256) (notice the difference when hovering over the link) vs. the current Birmingham (Q2256). I manually created this link leveraging some code from {{tooltip}} but we will want to be a little more robust like that template does (i.e., using{{#invoke:string|replace|description|"|"}}
) in case the WD description contains quotation marks. —Uzume (talk) 00:15, 13 September 2024 (UTC)- Exactly so. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 12:18, 13 September 2024 (UTC)
- Thanks for the clarification; you are right, I misunderstood Andy. I no longer oppose the change as you described it. Janhrach (talk) 17:40, 15 September 2024 (UTC)
- @Janhrach: I think Andy means he wants
- I forgot to note that Wikidata descriptions are not intended to be short. You can easily find ones long tens of words. Janhrach (talk) 17:34, 17 September 2024 (UTC)
- Wikidata descriptions are intended to be short. Note the first sentence of d:Help:Description (English language version); and the second of three bullet points in the "This page in a nutshell" box at the top of that page. The page continues
"In most cases, the proper length is between two and twelve words... If the description goes onto a second line it is probably too long, and if it goes onto a third line, it is almost definitely too long."
. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 18:53, 17 September 2024 (UTC)- Thanks. I had probably been confused by WP:SD-VS-WIKIDATA in the past, possibly by the
[Wikidata descriptions] in practice are often too long and intricate for use as Wikipedia short descriptions
part. Janhrach (talk) 15:24, 19 September 2024 (UTC)
- Thanks. I had probably been confused by WP:SD-VS-WIKIDATA in the past, possibly by the
- Wikidata descriptions are intended to be short. Note the first sentence of d:Help:Description (English language version); and the second of three bullet points in the "This page in a nutshell" box at the top of that page. The page continues