How to mutate bibliography access-date of specific references?

Hey guys I am using typst for writing all of my reports in my daily life and I am very happy with it.

Something that I have been wondering for quite some time, when using it for scientific papers and reports, is the following. When I use for example online references using e.g. a references.bib file that stores my references in the bibtex format. Then I usually have to update the urlDate property of these references manually. Meaning that whenever I make changes to my document I should also update the access date (urlDate property) of these references to conform with the citation requirements.

This means that my question is whether it is possible to somehow manipulate / change this property when showing the bibliography in the document. I am thinking about something like this:

#show bibliography.entry: it => {
  if (type(it) == "Online") {
     it.urlDate = new Date()
  }
  it
}

However, I was yet unable to achieve something similar because it seems like there is no entry property for the bibliography command. Also, I guess it would not be possible to mutate the urlDate property of an entry. However, it may be possible to achieve the desired behavior without having to mutate the it element, somehow.

Have you guys, by any chance, thought of something similar before or perhaps even done so in the past? Looking forward to reading your thoughts on this.

Hello @MartyByrde, it might be possible to use a combination of regexp to detect online entries in your bibliography and replace the access dates accordingly, however I do not recommend it for the following reasons:

  • the ground truth is your bibfile (or whichever software you use to manage your references), not your Typst document. If you want to update the urlDate property, then you should update your ground truth.
  • Websites are not immutable, hence you cannot guarantee that the website is identical to your previous reference if you change the access date. I recommend simply adding a new reference with a more recent access date. Best case scenario, you can cite from a digital archive like archive.org. From the Chicago Manual of Style, you can read about online references (if you need a specific version)

    If you do not cite an archived version, you will need to include an access date.

  • If you use Zotero with Better BibTeX, you can generate a unique citation key for onlines entries using the following formula
    (type(webpage)
    + auth.lower + '_' + (month ? month + '_': '') + year + '_accessed_' + 
    AccessDate.formatDate
    ) | (auth.lower + shorttitle(3,3) + year)
    )
    
    You will obtain something similar to carpenter_jul_2024_accessed_2024-07-11.

I understand it does not answer the original question, but I think this is a classic case of a XY problem!

2 Likes