Wrong "Pages" field for online journals with Nature Publishing Group translator
Hello.
Online journals from Nature Publishing Group have a field "Article number" which should be saved in the "Pages" field in Zotero, otherwise the citation is not correct. For some journals the "Pages" field is instead filled as "1-n" where n is the number of pages of the pdf.
It used to happen with Nature Communications, but the connector has been fixed, see related thread: https://forums.zotero.org/discussion/82431/nature-communications-article-number
However, the problem persists with other journals. See this post for Communications Physics (for which I still confirm this):
https://forums.zotero.org/discussion/99725/zotero-connector-wrong-pages-for-communications-physics-journal/p1
Moreover, I have experienced the same also for the journal npj Quantum Information https://www.nature.com/npjqi/ but I suspect other journals to be affected, I also have a paper with wrong metadata in my library from https://www.nature.com/npjmgrav/ for example.
Would it be possible to fix this also for the other journals in the same way it has been fixed for Nat. Comm.?
In case it helpful, to check my Zotero and Connector versions this is my Report ID: 1646674113
Online journals from Nature Publishing Group have a field "Article number" which should be saved in the "Pages" field in Zotero, otherwise the citation is not correct. For some journals the "Pages" field is instead filled as "1-n" where n is the number of pages of the pdf.
It used to happen with Nature Communications, but the connector has been fixed, see related thread: https://forums.zotero.org/discussion/82431/nature-communications-article-number
However, the problem persists with other journals. See this post for Communications Physics (for which I still confirm this):
https://forums.zotero.org/discussion/99725/zotero-connector-wrong-pages-for-communications-physics-journal/p1
Moreover, I have experienced the same also for the journal npj Quantum Information https://www.nature.com/npjqi/ but I suspect other journals to be affected, I also have a paper with wrong metadata in my library from https://www.nature.com/npjmgrav/ for example.
Would it be possible to fix this also for the other journals in the same way it has been fixed for Nat. Comm.?
In case it helpful, to check my Zotero and Connector versions this is my Report ID: 1646674113
I noticed that some papers in my library from Springer publications also had this issue and the Pages field was populated with a page range (e.g., “1–n”) instead of the article number. However, I tried saving one of those papers again, and now the Pages field is correctly populated with the article number. For example, I tested this paper:
https://link.springer.com/article/10.1140/epjb/s10051-024-00784-3
Despite the webpages for Nature and Springer journals being virtually identical, they use different translators:
• Nature: https://github.com/zotero/translators/blob/master/Nature Publishing Group.js
• Springer: https://github.com/zotero/translators/blob/master/Springer Link.js
In particular, the Nature translator includes the following code, which is not present in the Springer one. I believe this is responsible for the behavior I’m seeing:
if (item.pages && !item.pages.includes('-')) {
var start = text(doc, 'span[itemprop="pageStart"]');
var end = text(doc, 'span[itemprop="pageEnd"]');
if (start && end) {
item.pages = start + '-' + end;
}
}
if (!item.pages) {
// For some online-only publications this should be the "Article number"
// but is not present in either EM or RIS. We grab it from page
var page = doc.querySelector('.citation .page');
if (page) {
item.pages = ZU.trimInternal(page.textContent);
}
}
My understanding is that the “Article number” is now included in the RIS file, at least for the journals I’ve checked. Because this value doesn’t contain a hyphen, the first if block is triggered, resulting in an artificial page range being generated.
The Springer and Nature sites look similar (and share ownership) but have technical differences, hence the separate translators.
In general, the best way to report a translator issue is just to provide the exact URL(s) where you're having issues, along with a clear description of the problem you're seeing. Totally fine (and helpful!) to provide more information below that if you know what's going on.
No need to create a GitHub issue. Feel free to bump threads if you don't get any response after a couple weeks.
Thanks a lot for fixing this. My apologies for not respecting the etiquette of bug reporting.
I have indeed tried with a couple npj journals and it works as intended now.