add_coins() appends COinS metadata to a
finished Quarto blog post so reference managers like Zotero can
automatically detect it and import the title, author, date, and other
citation details into your library.
This article covers everyday usage first. If you want to understand what COinS actually is and why it works the way it does, see Background: What is COinS? further down.
add_coins()posts/your-post/index.qmd_quarto.yml file in your blog’s root directory with
at least site-url: specifiedWhen you call add_coins(), it:
_quarto.yml — reads site URL
and language settings_quarto.yml and .Rprofile options<span> at the end of your postAt the bottom of your index.qmd,
add_coins() appends:
This code: - Uses an R chunk with echo: false and
results: asis so it’s invisible to readers - Outputs the
COinS <span> as raw HTML - Is placed at the
end of your post, so Zotero sees the complete content first
By default, add_coins() reads everything it needs from
your post YAML and _quarto.yml. You only need to configure
.Rprofile for optional fallback values:
# Project-level .Rprofile (in your blog's root directory)
options(
qpost.lang = "en", # Fallback language if not in post or _quarto.yml
qpost.license = "CC-BY-4.0" # License code for all posts
)For each field, add_coins() looks in this order:
lang:,
license: in your post’s front matter)_quarto.yml (e.g., lang:
in your blog config).Rprofile options (e.g.,
getOption("qpost.lang"),
getOption("qpost.license"))This design means: - Most of the time, you don’t need
.Rprofile setup — your post YAML and
_quarto.yml suffice - Set qpost.license once
in .Rprofile to apply it to all posts automatically -
Post-level values always override defaults
The COinS span is just an R code chunk at the end of your post. You can:
title attributeadd_coins() againTo re-run add_coins() on an existing post: 1. Delete the
coins code chunk at the bottom 2. Run
add_coins(file_path = "posts/your-post/index.qmd") 3.
Review and commit the changes
By default, add_coins(backup = TRUE) creates a backup of
your post before modifying it:
This creates a file like posts/my-post/index.qmd.bak as
a safety measure. If something goes wrong, you can restore the
original.
To disable backups:
Once you’ve added COinS to a post, you can test it:
quarto preview
or quarto renderIf the save icon doesn’t appear, check that: - The HTML output
contains the COinS <span> (view page source in your
browser) - The metadata in the title attribute is properly
URL-encoded - Your Zotero browser extension is enabled
COinS stands for ContextObjects in Spans. It’s a simple, standardized way to embed bibliographic metadata directly into HTML pages so that specialized software can read and extract it.
Think of it like this: when you visit a website, humans see the text and can understand what a blog post is about. But reference managers like Zotero need machine-readable metadata to know the title, author, publication date, and other citation details without requiring manual data entry.
COinS solves this by embedding bibliographic information in an
invisible HTML <span> element on your page. When
Zotero visits your blog post, it detects the COinS metadata and can
automatically add the post to your library with all the correct fields
filled in.
With COinS, you provide metadata from your blog posts to software tools like bibliography managers, enabling automatic retrieval and making it easier to cite your articles correctly.
Without COinS, reference manager have to guess your post’s metadata by examining the HTML structure. This often fails for blog posts because:
<h1> tag, but so
might many other things<time> element or embedded in a longer text
stringCOinS eliminates guessing. When you add a COinS span to your post, reference manager and many other bibliography software and services can:
This is especially valuable for academic writers who rely on reference managers for literature management.
COinS is based on the OpenURL standard (ANSI/NISO Z39.88-2004), which was originally designed to help libraries link users to full-text content. The “ContextObject” is the standardized metadata package at the heart of OpenURL.
The clever part of COinS is that it embeds an OpenURL
ContextObject invisibly in HTML using a
<span> element:
The class="Z3988" tells processors like Zotero that this
span contains COinS metadata. The actual data is in the
title attribute (which is counterintuitive—it’s not
displayed as a tooltip; it’s just a container for the encoded
metadata).
Using a <span> allows COinS metadata to be placed
anywhere in a web page without breaking the HTML structure or being
visible to human readers. Other approaches (like storing metadata in
<meta> tags in the page’s <head>)
are more restrictive—you can only have one set of metadata per page.
With COinS, you can embed metadata for multiple items on the same
page.
COinS has been adopted by many major platforms and content providers:
When you’re browsing a blog post with COinS in your Zotero-enabled browser:
<span class="Z3988"> elementWithout COinS, Zotero might not recognize the page as a citable item, and you’d have to manually enter all the metadata.
COinS is particularly valuable if you:
qpost() — Create
new Quarto blog posts interactively