Module:Wd is permanently protected from editing because it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit.
This is the talk page for discussing improvements to the Wd module.
This module is within the scope of WikiProject Wikidata, a collaborative effort to improve Wikipedia's integration with Wikidata. If you would like to participate, please visit the project page.WikidataWikipedia:WikiProject WikidataTemplate:WikiProject WikidataWikidata
@Thayts and Janhrach: Hi. Is it possible to add support for P5017 last update property? It seems to be perfectly valid citation/reference property for continuously updated sources to indicate last-update date of the version actually cited and it is being used all over WD this way, see backlinks and stat. Right now rendering attempt of a citation having this property filled here on enwiki leads to a nasty error output:
^
Error: Unable to display the reference from Wikidata properly. Technical details:
Reason for the failure of {{Cite web}}: The Wikidata reference contains the property last update (P5017), which is not assigned to any parameter of this template.
Reason for the failure of {{Cite Q}}: The Wikidata reference contains the property last update (P5017), which is not assigned to any parameter of this template.
On other wikis such citations are citable at least, even if the last update value is not used. E.g.: [1].
If there really is a good reason to keep current strict semantics (i.e. to fail with error on any unknown/unmapped citation property instead of just ignoring it or maybe including some hidden note and a monitoring cat. assignment), maybe an explicit whitelist of "tolerated" though unused citation properties would be useful. It doesn't make much sense to be completely unable to render citations that are valid on WD itself and renderable on other projects. And another negative side effect of this approach is that if anyone adds such an unsupported property on WD side later, unaware of the limitations of this module, it will introduce an unintentional error here, that is out of control of the original author, who inserted a (then working) citation. That's definitely not nice behavior. --Teslaton (talk) 18:41, 24 November 2024 (UTC)[reply]
Hello, sorry for the late reply.
As for adding P5017, it is of course possible. Which Cite-web parameter should it be mapped to? Should it override publication date?
Note that wikidata:Help:sources does not mention this property at all, which, in itself, is not a problem. I am mentioning the Wikidata page because it is worth noting that references on Wikidata aren't really standardized. That page is, at least in my knowledge, the only one to say something about formatting references, yet it seems to be far from complete.
Unfortunately, there is no simple way to fix the citation-rendering function to just ignore unknown properties – outputting an error on failure is an inherent property of the (very simple) algorithm, as long as we want it to always produce understandable results. For example, an exteral id property (together with a "stated in" property) is sufficient to generate a Cite-web citation. However, this combination is also sufficient to create a Cite-Q citation. How should the module decide which citation template to use?
The original algorithm solved this problem by not using a citation template if the Wikidata reference contained any properties not mapped to its parameters. If neither of the templates could be used, a fallback citation was generated. However, this fallback was removed (almost two years ago), because it was dissimilar to existing citation styles and sometime quite human-unfriendly.
This is a very conservative solution – it rarely produces gibberish citations (e.g. leaving out information essential to the reference), but always fails on atypical Wikidata citations.
If you have ideas for a better algorithm, please share your ideas.
PS: After finishing writing this reply, I got an idea: maybe a good solution would be to ignore properties that are unknown to both of the citation templates (and issue an invisible error when encountering them). I will think about it.
I have implemented (in /sandbox) support for configuring the module (in /i18n) for using multiple Wikidata properties as sources for citation paramenters. These properties are ordered – each has it priority, which determines when to use the said property. I used this functionality to fix the above issue. (Both publication date and last update are used as a source for the date citation argument, but last update has higher priority.) I also used this mechanism to reimplement the usage of subject named as as a fallback for title. Your comments are welcome. Janhrach (talk) 16:48, 6 July 2025 (UTC)[reply]
Hi,
a Spanish Wikipedian noted that dates in Spanish use the article "de". For instance, "10 november 1992" will be "10 de noviembre de 1992". Is there a way to account for this in the i18n code? Julius Schwarz (talk) 08:31, 5 June 2025 (UTC)[reply]
Actually @Janhrach, even though this is not currently feasible in Wd, how would you go about adding an "s" to the currency in a forked module? Assuming the currency value is always plural. Julius Schwarz (talk) 07:24, 9 June 2025 (UTC)[reply]
Maybe. I have some work to do in the sandbox, which I want to finish before I start doing anything else related to this module. Janhrach (talk) 13:36, 15 June 2025 (UTC)[reply]
@Julius Schwarz For the first case, are you trying to output the date in that format? If so, as long as the input date is the raw "1992-11-10" or in English, you could set up the code to run the date through something like lang:formatDate(i18n.fullDate,'1992-11-10') and then, for Spanish, set i18n.fullDate = 'n \\d\\e F \\d\\e Y'. --Ahecht (TALK PAGE)14:14, 9 June 2025 (UTC)[reply]
@Julius Schwarz If you modify your module to do two calls to Module:Wd, one with the raw flag and one with the data flag, you can then do something like ifamount>1thenunit=unit..'s'end (and you would then have an override for languages such as Swedish where the plural of 'krone' is 'kroner'). I suppose you could also I did update Module:European and national party data/sandbox so that you can request the unit from allpp_get_data() or xlate_wikidata(). --Ahecht (TALK PAGE)20:53, 9 June 2025 (UTC)[reply]
@Julius Schwarz I don't have time to debug your code, but I think you need to specify raw=yes to get it without the unit. When I uncomment the 2nd-to-last line of the module (the one that exports xlate_wikidata) and run =p.xlate_wikidata('property','Q950179','P12919','','','','','','','unit=yes') in the console it returns euro and when I do =mw.getContentLanguage():formatNum(tonumber(p.xlate_wikidata('property','Q950179','P12919','','','','','raw=yes','',''))) it returns 171,460.56. --Ahecht (TALK PAGE)15:10, 10 June 2025 (UTC)[reply]
When seeking a value such as a population via this template, Wikidata will often have multiple values with different point in time (P585) qualifiers. Sometimes the most recent one will be given a preferred rank but sometimes not. Is there any way to ask it to retrieve the most recent one? I don't think (?) the future/current/former flags can work for this, both because they rely only on start time (P580)/end time (P582), not on point in time (P585), and because even if they did, the most recent value would just be one instance of a former value and wouldn't be prioritized if the other happened to be listed first.
Citations with archive URLs are displayed differently when the URL is specified as alive via |url-status=live vs. when it's specified as dead or not specified (see first paragraph of here). Would it be possible to create a way for this template to likewise specify URL status? Sdkbtalk00:22, 29 July 2025 (UTC)[reply]
Handling of Wikidata refs - empty titles and missing properties
We have a problem on cywiki where we have pages taking references from Wikidata. In 2023, @Janhrach very kindly forked the code and applied some additional handling to prevent visible errors. Time moves on and the code in the module has been refactored. I applied this version but it shows errors again - see https://cy.wikipedia.org/wiki/8_Mile
I would like to keep the module up-to-date, so I had various attempts to re-apply the previous fix - but as variables have changed, it's quite tricky. There are also some more significant errors regarding those properties such as Rotten Tomatoes and Meta Critic, which is potentially easier to fix. Is there a possibility of handling this in an easier way? I would prefer not to put in special handling just for us as it limits future updates, but it would be good to know what's feasible. I could revert my changes to what was working, but I suspect that I would also need to revert other updates to Citation/CS1 modules as well. Thank you. Dafyddt (talk) 22:42, 22 August 2025 (UTC)[reply]
Regarding the specific errors you have mentioned, the problem was that Wikidata says that references citing online databases need to contain both stated in (P248) and a property of the External identifier data type, while the references causing errors contained only the latter. This may seem like a minor technicality, but database references are handled by an ugly hack in the module, and I do not want to make this hacky code more complicated to support references like this. I plan to fix this issue by creating a separate template for citing database references; this will hopefully also eliminate cryptic error messages like these.
As for re-introducing the cywiki fix, the old code is probably of little use, because the code has changed quite a lot. If it is really needed, I can try to reimplement it, but I would strongly prefer if you waited until I make the fix I have mentioned in the previous paragraph.
Also, regarding the changes to this module since I made the cywiki fix, there were two of them that are especially relevant here:
I added verbose error messages. They should mostly be comprehensible after reading the documentation. I agree though that the errors you have mentioned are hard to understand; I will fix that.
|title= is no longer a mandatory param for {{Cite web}}. In practice, this means that missing titles in references do not cause errors in this module, but in the citation template, like you see in the article you have linked. This hopefully made the errors more understandable. When I create the database-citation template, many of these missing-title errors could be eliminated.
|title= is no longer a mandatory param for {{Cite web}}. False. I don't know where you got that idea but you are mistook. |title=is, and likely will always be, required by {{cite web}}. If you have found some place where it is stated that |title= is not required, name that place so that it can be visited and fixed.
I meant that this module does not consider it mandatory. I wrote that this means that missing titles in references do not cause errors in this module, but in the citation template[...]Janhrach (talk) 14:43, 26 August 2025 (UTC)[reply]
Yes, I saw that, but your initial declaration that |title= is not required by {{cite web}} is false. That declaration cannot be allowed to stand unchallenged.
I should have made it clear that I refered to my changes to this module. I now see that changes since I made the cywiki fix could have been interpreted as including changes to CS1. Janhrach (talk) 14:59, 26 August 2025 (UTC)[reply]
Hello, could we have more customization on Language label? I mean the part when code constructs cite web etc. I see it uses aliasesP.language which means for Q1860 it picks "English". Maybe we could "tell" in i18n configuration to return value of ISO 639-1 or even P424 if that language has it, of course we always fallback to aliasesP.language. This issue comes from my local wiki, for example Module is returning label in cite web that is giving CS1 error unrecognized language. Zygimantus (talk) 13:00, 28 August 2025 (UTC)[reply]
Possible? Certainly. But there other, possibly more important issues to fix first, and I do not want to devote too much time to this module. (Its creator has seemingly abandoned it.) A temporary solution would be to map aliasesP.language to an empty parameter, which would cause the aliasesP.language to be ignored. Janhrach (talk) 15:01, 5 September 2025 (UTC)[reply]
Yeah, need to think about it. I am generally using practice for modules from enwiki like this: I treat them like upstream repo and I do not want to "fork more" than adding translations or other minor localizations. Code changes in local wiki will mean that we would deviate too much from original code and could cause many problems. Zygimantus (talk) 10:19, 10 September 2025 (UTC)[reply]