pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Add CRAN's DOI in autogenerated CITATION

Open jmaspons opened this issue 1 year ago • 3 comments

Recently, all packages published at CRAN get a DOI. Would be nice to add it at authors.html#citation.

jmaspons avatar Jun 30 '24 08:06 jmaspons

The first problem to solve here is figuring out how to the get published DOI of a package. Then it looks like a fairly simple change to citation_auto(); we'd just override the existing DOI if it's null.

hadley avatar Jul 03 '24 13:07 hadley

I think that the DOI is deterministic

doi <- paste0("10.32614/CRAN.package.", pkg_name)
url <- paste0("https://doi.org/", doi)

Then it's just a matter of determining whether the package is published at CRAN or not, which it seems pkgdown already have functions for View on CRAN link.

jmaspons avatar Jul 04 '24 15:07 jmaspons

Oh well that's very easy then 😄

hadley avatar Jul 05 '24 15:07 hadley

Already in R utils::citation() https://github.com/r-devel/r-svn/commit/66292483683487a651e33e5fb9b63bc405e15015

jmaspons avatar Jul 19 '24 12:07 jmaspons

citation is a complicated function, probably worth waiting until utils::citation() deals with DOIs in the next release of R. @hadley approves of this strategy (dev day pers. comm)

luisDVA avatar Aug 15 '24 20:08 luisDVA

Thanks for the exploration!

hadley avatar Aug 15 '24 20:08 hadley