melat0nin / zotero-roam-export

A Zotero addon for exporting to Roam
MIT License
179 stars 12 forks source link

Feature request: include Zotero URI in export #11

Closed richardlm closed 4 years ago

richardlm commented 4 years ago

I have extracted this from #7 as you have now implemented BBT's Citekey.

Given that the Zotero unique id is - I assume? - part of the standard metadata, would it be relatively easy to include that in your metadata record? This links Roam and Zotero without the need to install any Zotero extensions (and BBT is a pretty heavyweight extension!).

The key can be used from within Roam with, e.g. zotero://select/library/items/9PFEWRDE if Zotero is installed, or https://www.zotero.org/users/<userid>/items/9PFEWRDE via the web.

This link back to the original, full, record in Zotero would be very useful to make use of Zotero's functions re formatting for citations and bibliographies, exploring related items, checking on metadata not in the Roam record, etc.).

(In the Zotero record I put the link back to the relevant page in Roam for easy round-tripping).

If you need more information please let me know.

melat0nin commented 4 years ago

Yes this is pretty straightforward. I could add, say, a link to both the local library and the web-based library (as you've included them). That would cover situations where you're using Roam on a machine that doesn't have Zotero installed/your library synced.

I'll investigate 👍

melat0nin commented 4 years ago

@richardlm

(In the Zotero record I put the link back to the relevant page in Roam for easy round-tripping).

Out of interest, where do you put this -- in a note?

richardlm commented 4 years ago

Yes. I considered using the URL field in the metadata block but that is often populated with a link to the publisher's site so I use Notes for other URLs: primarily the library catalogue permalink, but now also the Roam page.

melat0nin commented 4 years ago

Would something like this make sense?

Zotero items: [local](), [web](), [PDF]()

richardlm commented 4 years ago

Do you mean that's a suggested layout for the field in the metadata record for attachments?

I'm not sure what the 'PDF' entry is for as in my case the local and web links are generally to PDFs. For example, I store the main copy in WebDav storage, but also have a local (harddisk, backed up with OneDrive) copy for security / in case of no web access. Do you use 'PDF' for another reason?

The terminology that Zotero (and other apps) uses is not consistent but the general consensus seems to be 'attachment' for the stored copy - in either Zotero's filestore or, say, WebDav - and 'Linked' for a link to a locally-held file. I find your use of 'web' for the former and 'local' for the latter is perfectly clear, but may not be 'standard'.

melat0nin commented 4 years ago

Do you mean that's a suggested layout for the field in the metadata record for attachments?

I'm not sure what the 'PDF' entry is for as in my case the local and web links are generally to PDFs. For example, I store the main copy in WebDav storage, but also have a local (harddisk, backed up with OneDrive) copy for security / in case of no web access. Do you use 'PDF' for another reason?

The terminology that Zotero (and other apps) uses is not consistent but the general consensus seems to be 'attachment' for the stored copy - in either Zotero's filestore or, say, WebDav - and 'Linked' for a link to a locally-held file. I find your use of 'web' for the former and 'local' for the latter is perfectly clear, but may not be 'standard'.

The PDF link directly opens the file (if locally available and Zotero is running) -- focus switches to Zotero, and the PDF is automatically opened in your default PDF viewer.

The type of link you provided -- zotero://select/library/items/9PFEWRDE and https://www.zotero.org/users/<userid>/items/9PFEWRDE -- simply select the item in Zotero/the web library. This is useful for a different reason (say you want to check metadata not included in the Roam export, or want to do something else Zotero-specific). Note how the URL handler is different for the PDF link -- zotero://open-pdf/... instead of zotero://select/....

How about this:

Zotero item: [local library](), [web library](), [PDF attachment]()

The first link would open the Zotero client and focuses the item, the second opens the web library and focuses the item, and the third automatically opens the local PDF (if the client is running locally).

Happy to consider other labels if they make more sense!

richardlm commented 4 years ago

Ok, there is more this than I first thought - I'm clearly not a power user!

The three labels make good sense to me and the functionality will be very useful.

I may have mistunderstood, but I see the first two links get you to the record in standalone and web Zotero - which is exactly what I want - but with the focus on the attachment. Is it possible to go to the record with the focus on the metadata page? This would be more useful for me, and would cover the cases where there are no attachments, but is that possible?

If it is possible, then having the links to local metadata page, web metadata page, PDF attachment would be perfect.

Thanks, Richard

melat0nin commented 4 years ago

@richardlm

This has been added, and I'll create a release tomorrow.

image

I'm not sure why the local and web links focus the attachment for you; for me they focus only the parent item (as expected). Assuming that's some kind of bug for you (sorry!) I've proceeded as planned.

melat0nin commented 4 years ago

Implemented in v1.8 https://github.com/melat0nin/zotero-roam-export/releases/tag/v1.8

richardlm commented 4 years ago

I'm adding this comment to #11 even though it is closed, as it concerns the implementation - happy to transfer to new issue if you prefer.

Firstly, I really like the way that zotero-roam-export enhances the workflow between Zotero and Roam without the need to use any add-ons - it is immensely useful!

My comment is on the 'Zotero links'. The three types of link work as expected for me:

However, in my case, I often have the same PDF stored in two places:

zotero-roam-export provides links to both, which is good and expected behaviour, but they look identical so I don't know which is the main (Zotero-controlled) copy.

Is it possible to differentiate these in the metadata presentation? If not, I could go through renaming one set but I would rather not.

Thanks again for this very helpful tool.