The best way to ensure codemeta.json
is as complete as possible is to set metadata in all the usual places, and then if needed add more metadata.
To ensure you have metadata in the usual places, you can run codemetar::give_opinions()
.
Fill BugReports
and URL
.
Using the Authors@R
notation allows a much richer specification of author roles, correct parsing of given vs family names, and email addresses.
In the current implementation, developers may specify an ORCID url for an author in the optional comment
field of Authors@R
, e.g.
Authors@R: c(person(given = "Carl", family = "Boettiger", role = c("aut", "cre", "cph"), email = "cboettig@gmail.com", comment = c(ORCID = "0000-0002-1642-628X")))
which will allow codemetar
to associate an identifier with the person. This is clearly something of a hack since R's person
object lacks an explicit notion of id
, and may be frowned upon.
In the README, you can use badges for continuous integration, repo development status (repostatus.org or lifecycle.org), provider (e.g. for CRAN).
If your package source is hosted on GitHub and there's a way for codemetar to determine that (URL in DESCRIPTION, or git remote URL) codemetar will use GitHub repo topics as keywords in codemeta.json. If you also set keywords in DESCRIPTION (see next section), codemetar will merge the two lists.
In general, setting metadata via the places stated earlier is the best solution because that metadata is used by other tools (e.g. the URLs in DESCRIPTION can help the package users, not only codemetar).
The DESCRIPTION file is the natural place to specify any metadata for an R package. The codemetar
package can detect certain additional terms in the CodeMeta context. Almost any additional codemeta field can be added to and read from the DESCRIPTION into a codemeta.json
file (see codemetar:::additional_codemeta_terms
for a list).
CRAN requires that you prefix any additional such terms to indicate the use of schema.org
explicitly, e.g. keywords
would be specified in a DESCRIPTION file as:
X-schema.org-keywords: metadata, codemeta, ropensci, citation, credit, linked-data
Where applicable, these will override values otherwise guessed from the source repository. Use comma-separated lists to separate multiple values to a property, e.g. keywords.
See the DESCRIPTION file of the codemetar
package for an example.
There are a number of places that codemetar will reference a github branch if your code is hosted on github (e.g. for release notes, readme, etc.). By default, codemetar will use the name "master" but you can change that to whatever your default branch is by setting the option "codemeta_branch" (e.g. options(codemeta_branch = "main")
before calling write_codemeta()
to use the branch named "main" as the default branch).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.