Is it possible to add Perma.cc to a Zotero field?

I wonder whether there is a way to add a Perma.cc link in Zotero so it would be reflected in the final citation format (i.e., Harvard) after the source link like this: (archived at https://perma.cc/...) or [https://perma.cc/...]
«1
  • Is your URL field already populated?
    If not, you could just modify a citation style to include just that.
  • One could hack this using the archive field, but there's nothing that'll work in any existing citation style.
  • What style specifically are you working with?
  • @adamsmith, when you suggest using the "archive" field, what would that look like in the resulting citation string?

    @bwiernik, I am using Harvard.
  • CSL treats most fields like a string (the exceptions are names, dates, and numbers) -- there's nothing special about a field like URL for CSL purposes, to you can use
    <text variable="archive" prefix="(archived at " suffix=")"/> in any style to produce the above note -- you'll want to pay attention to whether a style already uses archive: that's make this trickier and you'll then want to think about how to detect archive web vs. physical archive content (e.g. by testing for a URL)
  • So, would I just input the perma.cc link into different fields and try different styles to see which one fits?
  • No, as I say above, "but there's nothing that'll work in any existing citation style." -- you'd want to customize your style if you really need it.
  • Unfortunately, it appears what you suggest is beyond my abilities as I do not understand how to implement it. Thanks anyways.
  • @sartorio There are hundreds of "Harvard" styles in the repository. What style specifically are you using?
  • @bwiernik Elsevier - Harvard (with titles) or SAGE - Harvard
  • In Zotero, click the Tools menu, then Developer → Style Editor.

    Select either of those styles.

    Scroll all the way to the bottom of the style. Just above the last </layout> tag, add this line:
    <text variable="archive" prefix=" (archived at " suffix=")"/>

    Scroll to the top of the file and change the <title> and <id> tags to anything else so that your changes aren't overwritten.

    Click Save As, save the file somewhere on your computer, then find it and double click on it to install into Zotero.
  • I got this message: is not a valid CSL 1.0.1 style file, and may not work properly with Zotero.
  • I saved it anyways... So, which field should I add the perma.cc link to test the output?
  • No, you mistyped something. Validate your style here and correct the errors https://validator.citationstyles.org/

    Then, add the perma.cc address to the Archive field in Zotero
  • Here is the error the validation gave me:
    Errors
    Line 306: Element “text” from namespace “http://purl.org/net/xbiblio/csl” not allowed as child of element “bibliography” from namespace “http://purl.org/net/xbiblio/csl” in this context. (Suppressing further errors from this subtree.)


  • I erased the saved style and redid the steps. Here is how the line looks like after I add what you suggested:


    I am unsure whether I need to substitute or copy next to it as I just did.

    I checked and I am using Cite Them Right 10th edition - Harvard, instead.
  • Any thoughts?
  • edited June 21, 2021
    You need to wrap any CSL code between <code> and </code> for us to be able to see it.
  • You need to place your new text element inside </layout>, not after it.
  • Ok, I think it is clear from my previous messages that I do not have your level of code competency...

    Before:
    After (1):
    or
    After (2): </<text variable="archive" prefix=" (archived at " suffix=")"/>>
    or
    After (3): </<text variable="archive" prefix=" (archived at " suffix=")"/>>

    ??
  • It did not come through...

    Before:
    After (1): >
  • Ok, I am typing what the different alternatives and it is not working so I will try this:

    Before: The layout code as is
    After (1): Substitute the word "layout" for the code you provided leaving the / as is
    or
    After (2): Adding the code you sent after the word "layout" in the layout code
    or
    After (3): Substitute the word "layout" for the code you provided including the /
  • None of these. You place that line right before </layout>, leaving everything else, including </layout> where it is.
  • I followed all your steps and when I double click on the file to install in Zotero, I get this message:
    Update existing style "Cite Them Right 10th edition - Harvard" with "Cite Them Right 10th edition - Harvard" from /Users/sartorio/Documents/personal/Documents - Esq/UC3M/Admin/Zotero/harvard-cite-them-right-PERMcc.csl?

    I clicked yes, which updated the existing cite them right... style instead of creating a new one...
  • You’re almost there. In your edited style, at the top change the <title> and <id> fields to something else.
  • Ok. I got it. Ran it through the validator with no problems. Thanks!

    Nos, which field in Zotero do I use to add the perma.cc to test the citation?
  • Archive (and where that doesn't exist, archive: perma.cc/123445 in Extra)
  • Got it. Quick question. The format appears ... Available at www.https://Link (Accessed DATE)(archived at perma.cc)...

    Where can I move the code you gave me within the style editor so the "archived at..." appears right after the link where the source was originally at?
  • add it in as a new line right between these two:
    <text variable="URL"/>
    <group prefix=" (" delimiter=": " suffix=")">
    (these are much further up in the style, about 1/3 from the top)
Sign In or Register to comment.