Citations

Arguably the most important feature of this template is its ability to automatically generate citations from simple identifiers. This makes it easy to cite and maintain large lists of publications.

The template is able to do this thanks to Manubot, a suite of tools that (among many other things) lets you automatically generate a citation with full details from just a short identifier, like doi, url, isbn, pmc, pmcid, pubmed, arxiv, and many many more.

How it works

First let's define some consistent terminology to make things easier to explain:

  • source - A paper, book, article, web page, film, or any other published item you want to cite.

  • metasource - A single item that lists multiple sources, like how an author's ORCID number can be used to get a list of their published works.

  • citation - Full, detailed information about a source, like title, author(s), publisher, publish date, URL, etc.

For most content on your site, you just need change the contents of the appropriate file. Citations have a special additional step. When you add new sources or metasources to be cited, the template has to run a special "cite process" to generate your full citations.

At a high level, here's how it all works:

  1. Input your sources and metasources in /_data files, e.g. sources-2020.yaml, orcid-students.yaml, etc.

  2. The cite process runs – either on GitHub or locally – to convert your sources and metasources to full citations.

  3. The cite process outputs a single citations.yaml file in /_data.

  4. Display and filter citations on your site with the list and citation components.

Do not edit citations.yaml! It will get overwritten each time the cite process runs. If you need to manually input or correct things, see below.

The cite process in detail...
  1. Each source/metasource file gets processed by the appropriate cite plugin (see /_cite/plugins) based on filename prefix.

  2. In metasource files, each list entry gets expanded into a list of regular sources. Any fields you put in the original entry get copied to each source in the expanded list.

  3. In source files, each list entry stays as-is.

  4. Metadata about the cite process is attached to each source, like which input file it originated from and which cite plugin it ran with.

  5. A full list of regular sources is compiled, with duplicates merged together by id.

  6. When merging two entries, if the same field is present in both, the one that comes later in the full list overwrites the one that comes earlier (because there cannot be two keys with the same name on an dict/object).

  7. Manubot generates full citation details for each source that has an id.

  8. Any field originally on each source is preserved.

You can mix and match as many sources and metasources as you want, and display them however and wherever you'd like! For example, you may want to have a "CV" page that lists all of the papers under your PI's ORCID, then reserve your "Research" page for just a few special papers by various members in your lab that you want to highlight.

Examples

Basic id

Filename must start with sources.

/_data/sources.yaml
- id: doi:10.1098/rsif.2017.0387
- id: pubmed:29424689
- id: pmc:PMC5640425
- id: arxiv:1806.05726
# ...more sources
ParameterDescription

id

Identifier for the source that Manubot can understand and cite. If Manubot is unable to generate a citation for this ID, the template will log an error message and exit with an error code.

Rich details

Optionally, you can manually pass extra "rich" details that the template can display nicely. Manubot can't automatically determine these.

/_data/sources.yaml
- id: arxiv:1806.05726
  type: paper
  description: Lorem ipsum _dolor sit amet_.
  image: https://publisher.com/striking-image-for-your-paper.jpg
  buttons:
    - type: source
      link: https://github.com/your-lab/some-repo
    - type: website
      text: My Personal Website
      link: http://some-website.com/
  tags:
    - biology
    - big data
    - medicine
  repo: your-lab/some-repo

# ...another source
ParameterDescription

type

The type of the source. Determines the icon to show. See /_data/types.yaml for what types are built-in or to add your own.

description

Brief description of the source. Can contain Markdown.

image

URL to a striking image for the source. Highly recommended. Displays as a thumbnail next to the citation details.

buttons

List of buttons to show underneath the citation details.

tags

List of tags to show underneath the citation details.

repo

GitHub repository to automatically fetch additional tags from.

Always provide a good thumbnail for your publications. Use a figure from the source, or if there are none, a journal logo or issue cover. Here are some best practices for making a good thumbnail image.

Manual override

All fields you attach to a source (or metasource, see below) get passed through to the generated citation untouched. This allows you to manually input or correct details of a citation.

/_data/sources.yaml
# manually correct specific citation detail
- id: pmc:PMC5640425
  publisher: Cold Spring Harbor

# manually provide all citation details
- title: Some Publication Title
  authors:
    - "**Steve McQueen**"
    - Lightning McQueen
  publisher: bioRxiv
  date: 2021-01-01
  link: biorxiv.org/1234

# attach an arbitrary field
- id: pmc:PMC5640425
  some-field: 123
ParameterDescription

title / authors / publisher / date / link

Basic citation information normally returned from Manubot and displayed by the citation component. Date should be in YYYY-MM-DD format. Authors can contain Markdown.

If you don't provide an id, Manubot has nothing to cite and so doesn't run. You'd only want to do this if manually providing all the citation details manually. This defeats the main benefit of the template, but is sometimes necessary.

You can also attach arbitrary fields. The template won't explicitly use them, but you could use them to filter citations with the list component.

ORCID

ORCID is the recommended way to retrieve a complete set of published works for an author.

Filename must start with orcid.

/_data/orcid.yaml
- orcid: 0000-0002-4655-3773
  jane-doe: true

# ...another author

Each ORCID gets expanded into a full list of regular sources with ids. Any fields you put in the original entry get copied to each source in the expanded list. This applies to the other types of metasources below as well.

To conveniently and explicitly associate an ORCID with a person for filtering with the list component, you can add a unique field for that person like in the example above and use a filter like this:

{% include list.html data="citations" component="citation" filters="jane-doe: true" %}
Why do the filter like that?

Why have the unique author be the key (e.g. jane-doe: true) instead of the value (e.g. member: jane-doe)? If you do the latter, and two people are authors on the same source, only one of the authors will be kept (whichever is listed last). This is a result of behavior described elsewhere on this page (duplicate sources merged into one, cannot have duplicate keys on dict/object).

Because the cite process merges duplicate sources by id, you can also use the manual override method above to manually correct sources returned from metasources. You can also use the special remove field to ignore a source returned from a metasource, discarding it from the citations output. Example:

/_data/sources.yaml
# some paper returned by an ORCID with a wrong title
- id: doi:123/456
  title: Correct Title

# some paper returned by an ORCID that you don't want to keep at all
- id: pubmed:123456
  remove: true

If a metasource returns a source with a type of identifier that Manubot doesn't know how to cite, that source will be ignored. When this happens, the cite process prints a warning, not a critical error, so you'll have to check your CLI output or GitHub Actions logs.

PubMed

See ORCID above for general metasource functionality.

Uses NCBI eutils to search PubMed for terms. This is a brittle way to select an author's papers, very vulnerable to false positives. ORCID is recommended.

Filename must start with pubmed.

/_data/pubmed.yaml
- term: "Greene, C[Author] NOT Greene CE[Author]"

Google Scholar

See ORCID above for general metasource functionality.

Unfortunately, Google does not provide APIs for many of its services, and that includes Scholar. Luckily there is a 3rd-party API to access it, SerpAPI. First you'll have to sign up and get an API key. Then, if running the cite process on GitHub, make a new repository secret named GOOGLE_SCHOLAR_API_KEY with your API key as its value, or if running locally, put the same name/value in a .env file.

Filename must start with google-scholar.

/_data/google-scholar.yaml
- gsid: ETJoidYAAAAJ

Periodic updates

Metasources like ORCID update over time as you publish new sources. As such, the template periodically re-runs the cite process without provocation. This will get the latest sources associated with your metasources, generate citations like normal, and open a pull request to let you review the changes before publishing them.

Cache

If you have many sources, generating the citations for all of them can take a while. To save time, the cite process keeps a time-to-live cache for Manubot/ORCID/etc. network requests. If a cached response hasn't expired, it is used instead of making a new request. To clear this, simply delete the cache file in _cite. You can also customize the default expire times in the Python code in _cite.

Last updated