Open Elaws opened 2 years ago
same request
I want this too. This seems almost the same as https://github.com/hans/obsidian-citation-plugin/issues/136.
Generally, would you all agree that using the Zotero ID is more permanent than using the citekey (the way this plugin currently creates Zotero select links)? I say this because I've been inserting links, then remembering to add a date or change the title of a Zotero item later on and it breaks all old select links since the citation key updates. Thus I think the Zotero ID would probably be better long-term, even if you do give up the intrinsic information in the citekey.
Mabye one general question: Do ZoterUris with citekey (instead of Zoter ID) work for you? In my case (and it looks like I am not the only one: https://github.com/hans/obsidian-citation-plugin/issues/192) it does not...
Mabye one general question: Do ZoterUris with citekey (instead of Zoter ID) work for you?
Yes, in order for this to work you need to have the betterbibtex addon installed. Zotero on its own only understands Zotero select links with a Zotero identifier.
As for the feature request: yes, it would be nice, but I think it is beyond the scope of this obsidian plugin because it relies on the biblatex file you are feeding it (usually via an automated export from zotero). So before the plugin can use the zotero ID, it needs to be exported into the biblatex file (and this is not done by the plugin). While it is certainly feasible technically, I’m not sure the results justify the effort of implementing such a non-standard bib(la)tex export.
If you need access to all database fields from zotero, I recommend you use the obsidian zotero integration plugin (https://github.com/mgmeyers/obsidian-zotero-integration).
@tophee After reading your description, I agree that this implementation needs to take place elsewhere.
Thus, I created this issue on the Better BibTEX plugin to add the zotero internal item ID as an option and the developers have already added the functionality (🤯). To make it work here without plugin modification, you can simply set your Better BibTEX citation key format to item
which will make it a value like W62VT739
that equals the internal item ID. Maybe counterintuitive for using the plugin, but I want my citekeys to be the item IDs.
Then, in your Obsidian citations plugin 'Literature note content template' setting form, you can add [{{title}}](zotero://select/library/items/{{citekey}})
, and the links will work.
The issue I linked also has a resolution of using Better BibTEX postscript to change the JSON CSL id
field of a citation to be this internal ID (and not mirror the citekey) in case you don't want to give up your citekey. I think this id
key is accessible deep in the citations plugin docs if you use the right syntax.
Yes, in order for this to work you need to have the betterbibtex addon installed. Zotero on its own only understands Zotero select links with a Zotero identifier.
Thanks a lot @tophee , that was the missing piece of information I needed!
and the developers have already added the functionality (🤯).
yes, mindblowing.
@ryanwwest so, just to clarify, the solution that just happened in no time entails that you can use either the (real) citekey or the zotero ID (living in the citekey field) but not both? Is that correct?
@tophee, yes it works. I tested it and the steps @ryanwwest mentioned work:
item
in the Better BibTex Plugin Settings in Zotero[{{zoteroSelectURI}}](zotero://select/library/items/{{citekey}})
Works at least for me. Only drawback is, that this works only for new entries in Zotero. Older ones seem to keep the CiteKey based on author and year. I could not find an option (whether in Zotero nor in the Better BibTexPlugin) to reindex all entries and update the citekey to the Zotero Item ID...
Maybe someone has an idea how to update all existing citation IDs (although I understand, that this maybe not a good solution for all users...)
@tophee For the solution I described here, yes, it's an either-or. However, in the issue I created and referenced above, I also inquired about a way to modify the JSON export so that the id
field in it could vary from the citation-key
field (which I believe is where this plugin gets its citekey value). See here for the example. This was also implemented. While I haven't tried this myself, I'm pretty sure you can get the id
value from this plugin (it's deep in the documentation somewhere) yet not change the citation key.
@ArPhil I had the same problem and figured out an easy solution. In Zotero, navigate to your root library collection where you can select all articles. Then cmd/ctrl-a to select all and right click, then use option Better BibTEX -> Unpin BibTEX key to allow all of the keys to be changed (if you want this - I most certainly did), then after that completes, do the same thing but instead selection option Better BibTEX -> Refresh BibTEX key. This immediately changed all my citation keys for all 200+ docs I have. I can see the updated citation key at the top of the right sidepane on the Info tab.
@ryanwwest, That is awesome! Thanks a lot! It worked like a charm! :-)
What would it take to get item
as an additional field to use in the plugin, instead of having it replace citekey
?
I've managed to get both a custom citekey and the zotero ID to work, by adding they key to the BetterBibTeX export, but only with the .bib
export. CSL doesn't give me access to the custom fields under entry.data.fields
. It would be nice to get this working with CSL/JSON which is faster, or even connect directly to the zotero.sqlite
which would save an export step and remove a dependency.
postscript
settings add a zotero-key
field:if (Translator.BetterBibLaTeX) {
tex.add({ name: 'zotero-key', value: zotero.itemKey});
}
Export using BetterBibLaTeX.
In the obsidian-citation settings, the following template can extract it:
---
title: "{{title}}"
authors: "{{authorString}}"
year: {{year}}
publisher: "{{publisher}}"
abstract: "{{abstract}}"
citeKey: {{citekey}}
itemID: {{entry.data.fields.zotero-key}}
---
### [{{title}}]({{zoteroSelectURI}})
{{note}}
Hello,
Is there any way to get Zotero IDs of a given item, as a value to use in template ?
e.g. : In this URI :
zotero://open-pdf/library/items/DWDDHZU3
, ID isDWDDHZU3
.It could be used as
{{entry.zoteroID[i]}}
wherei
is the attachment number of a given Zotero item.I would like to add my Zotero storage inside my vault : Zotero IDs would allow to get a cross-platform relative path to my PDFs.
Thanks !