
Adding COinS Metadata for Zotero
Peter Baumgartner
2026-09-10
Source:vignettes/add-coins.Rmd
add-coins.Rmdadd_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.
Using add_coins()
Prerequisites
- A completed Quarto blog post in
posts/your-post/index.qmd - A
_quarto.ymlfile in your blog’s root directory with at leastsite-url:specified
What Happens
When you call add_coins(), it:
- Reads your post’s YAML — extracts title, author, date, categories, description
-
Queries
_quarto.yml— reads site URL and language settings -
Applies auto-resolution — fills gaps from
_quarto.ymland.Rprofileoptions - Generates COinS metadata — creates key-value pairs (title, author, date, language, license, etc.)
-
Appends a hidden R code chunk to render the COinS
<span>at the end of your post - Opens the edited file — so you can review and commit
What Gets Generated
At 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
Configuration
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
)Auto-resolution Priority
For each field, add_coins() looks in this order:
-
Post YAML (e.g.,
lang:,license:in your post’s front matter) -
_quarto.yml(e.g.,lang:in your blog config) -
.Rprofileoptions (e.g.,getOption("qpost.lang"),getOption("qpost.license")) - Omitted if not found anywhere
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
Editing COinS After Creation
The COinS span is just an R code chunk at the end of your post. You can:
-
Edit it manually — change metadata values directly
in the
titleattribute -
Regenerate it — delete the chunk and run
add_coins()again - Remove it — delete the chunk entirely (though this defeats the purpose!)
To 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
Backup Mode
By default, add_coins(backup = TRUE) creates a backup of
your post before modifying it:
add_coins(file_path = "posts/my-post/index.qmd", backup = TRUE)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:
add_coins(file_path = "posts/my-post/index.qmd", backup = FALSE)Testing Your COinS
Once you’ve added COinS to a post, you can test it:
-
Render your blog with
quarto previeworquarto render - Open the post in your browser
- Install Zotero browser extension (if you haven’t already) from zotero.org
- Click the Zotero save icon in your browser address bar
- Verify the metadata — Zotero should pre-fill the title, author, date, and other fields automatically
If 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
Background: What is COinS?
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.
Why Use COinS?
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.
The Problem
Without COinS, reference manager have to guess your post’s metadata by examining the HTML structure. This often fails for blog posts because:
- Blog post titles might be in an
<h1>tag, but so might many other things - The publication date might be hidden in an obscure
<time>element or embedded in a longer text string - Authors are rarely marked up consistently across different blog platforms
- Categories or tags have no standard HTML representation
The Solution
COinS eliminates guessing. When you add a COinS span to your post, reference manager and many other bibliography software and services can:
- Automatically detect the post’s metadata — no manual entry needed
- Save the post to your personal library — with correct author, date, title, and keywords
- Use correct citation formatting — because software or service knows the post is a blog article, not a book or journal article
- Reference it in your writing — The software generates correct citations in your preferred style (Chicago, APA, etc.)
This is especially valuable for academic writers who rely on reference managers for literature management.
The Standard Behind COinS
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).
Why a span?
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.
Websites Using COinS
COinS has been adopted by many major platforms and content providers:
- Wikipedia — embedded in citation templates and bibliographic data
- Academic repositories — CiteULike, Semantic Scholar, PubMed Central, PubMed, ResearchGate
- Bibliography managers — Zotero, ZoteroBib, BibDesk, Mendeley, Citavi
- Library catalogs — Library Hub Discover, WorldCat, VuFind
- Publishing platforms — WordPress blogs, Institutional repositories
- Specialized services — Zotero itself can generate COinS for shared bibliographies
How Zotero Uses COinS
When you’re browsing a blog post with COinS in your Zotero-enabled browser:
- Zotero’s browser extension scans the page and finds the
<span class="Z3988">element - It decodes the embedded metadata
- It displays a save icon (📖) in your browser address bar, indicating that Zotero can capture the page
- You click the icon to save the post to your library
- Zotero populates the entry with all the metadata from COinS: title, author, date, description, etc.
Without COinS, Zotero might not recognize the page as a citable item, and you’d have to manually enter all the metadata.
Integration with Academic Workflow
COinS is particularly valuable if you:
- Write papers that cite your own blog posts — Zotero can cite them with proper formatting
- Build a personal knowledge base — Zotero can organize your posts alongside other research
- Share research — Others can easily add your posts to their Zotero libraries
- Track citations — Zotero note-taking features work with your posts as regular bibliographic items
Further Reading
- OpenURL Standard (Z39.88-2004) — The official specification
- COinS Specification (Wayback Archive) — Original COinS documentation
- Zotero Browser Extension — Download and documentation
- Zotero Support: Saving Items — How Zotero captures web content
See Also
-
qpost()— Create new Quarto blog posts interactively - Quarto Blog Documentation