Skip to contents

[Experimental]

update_metadata() derives a schema.org Dataset description from the canonical sources of the package and writes it as a JSON-LD block into the head of every pkgdown page, where dataset search engines read it. Nothing is hand edited: to change a value, change its source and run the function again. Running it twice produces no change. It ends by listing the fields it could not fill and where to fill them.

The sources are:

FieldSource
name, description, version, datePublished, licenseTitle, Description, Version, Date, License in DESCRIPTION
urlthe pkgdown site (a github.io entry in URL), else the repository
keywordsX-schema.org-keywords in DESCRIPTION, comma separated
spatialCoverage, temporalCoverageX-schema.org-spatialCoverage and X-schema.org-temporalCoverage in DESCRIPTION
isBasedOnthe source article DOIs in X-schema.org-isBasedOn in DESCRIPTION, comma separated
creator, maintainer, funder, publisherAuthors@R roles aut/cre, cre, fnd, cph; ORCID from the comment field, and the ROR comment key of an organisation as its @id. Without a cph, the publisher is the organisation with the website in Config/washr/home. The organisations in Config/washr/parent-organizations nest under the publisher as parentOrganization, a https://ror.org/ URL as the @id; the entries up to and including the publisher itself (same name, or the publisher name followed by a comma) are skipped
includedInDataCatalogthe data catalogue of the organisation in Config/washr/catalog
identifier, sameAsthe DOI in CITATION.cff, written by update_citation()
variableMeasureddata-raw/dictionary.csv
distributionevery file in inst/extdata that belongs to a dataset, one entry per file

The JSON-LD lands in pkgdown/templates/in-header.html, which pkgdown picks up on the next site build. The file also keeps the in_header includes from _pkgdown.yml working. The same JSON-LD is also written to pkgdown/assets/metadata.jsonld, which pkgdown copies to the root of the site, so the metadata has its own address (<site>/metadata.jsonld) for tools that read files rather than page heads; the README links it. Each file is written only when its content changed. Neither is shipped in the package tarball.

Usage

update_metadata(quiet = FALSE)

Arguments

quiet

Logical. Suppress the messages and the report of blank fields. Defaults to FALSE, or to TRUE when options(washr.quiet = TRUE) is set.

Value

The Dataset description as a list, invisibly. The "blank" attribute names the fields that could not be filled and says where to fill them.

See also

Before: update_description(), which writes the DESCRIPTION fields this reads. Next: setup_readme(). The DOI comes from update_citation().

Other metadata functions: update_citation(), update_description(), update_zenodo_json()

Examples

if (FALSE) { # \dontrun{
update_metadata()
} # }