Inserting citations and blogdown

Still learning a lot about R, so I apologize if I'm violating any norms here.

I'm using blogdown for my personal website (hosted via Netlify). I'm authoring a post and, specifically, I'm trying to insert scholarly references into this blogpost. Unfortunately, the citation key is not being read for some reason.

The text is below...

I'm particularly interested in incentives to institutions and researchers for making their work essentially "born open" [see @rouderWhatWhyHow2016].

I've checked to see if the citation key accurate (it is). There are no errors that are generated when the website is rendered. In fact, the text above is exactly as is it renders online.

My YAML header is below:

---
title: What can open science learn from how we fight pollution?
author: Chris
date: '2019-01-13'
slug: what-can-open-science-learn-from-how-we-fight-pollution
categories:
  - open science
tags:
  - Open science
image:
  caption: ''
  focal_point: ''
bibliography: r-references.bib
link-citations: TRUE
bilbio-style: "apalike"
---

The citation key is below:

@Article{rouderWhatWhyHow2016,
  title = {The What, Why, and How of Born-Open Data},
  volume = {48},
  issn = {1554-3528},
  doi = {10.3758/s13428-015-0630-z},
  language = {en},
  number = {3},
  journal = {Behavior Research Methods},
  author = {Jeffrey N. Rouder},
  month = {sep},
  year = {2016},
  pages = {1062-1069},
  file = {/Users/chriscastille/Zotero/storage/JRHT7B9U/rouder2015.pdf;/Users/chriscastille/Zotero/storage/SCNJSG6F/Rouder - 2016 - The what, why, and how of born-open data.pdf},
}

Any advice?

Chris

1 Like

So there are 3 pieces you need to make this work (see: https://blogdown-demo.rbind.io/2017/08/28/adding-citations-to-posts/):

  1. Save a BibTeX file(s) in the /content/post/ directory. The file should be a plain-text file that contains citations that generally look like this:

    @ARTICLE{key,
    required_fields [, optional_fields] }
    
  2. Reference the BibTeX file(s) in the YAML header of your post (and add link-citations: true to YAML if you want the links to show up in text):

    ---
    bibliography: [one.bib, another.bib, yet-another.bib]
    ---
    
  3. In the text of your post, reference items in BibTeX file(s) using @key

So from what you posted, I can see that you have done 2 and 3. What we can't see is that the .bib file r-references.bib is in the same folder as your blog post. Is that true? If it is, can you share a GitHub repo with your code? Other things I can't see: what versions of Hugo and blogdown you are using- are they up to date?

As a troubleshooting strategy, have you tried following the blog post to add cites for R packages using knitr? This way you could rule out whether this is an issue with your .bib file versus blogdown.

1 Like

Thanks for the guidance, but I'm still having some trouble.

My Github repo can be found here (https://github.com/chriscastille6/website).

The issue may have to do with the bib file is being referenced. I'm using the citr package to manage my citations. That might be causing a problem.

Hi Chris,

Using your site locally, I cannot get your bibliography to show up for that post either. But, in a new post citing R packages (I copied from this blog post: https://raw.githubusercontent.com/rbind/blogdown-demo/master/content/post/2017-08-28-adding-citations-to-posts.Rmd), I was able to get them to show up.

I went back to your repo and realized you are using .Rmarkdown posts instead of .Rmd. Interestingly, that matters!

Here is my repo:

and the rendered site:
https://chriscastille.netlify.com/

1 Like

@ccastille I updated your original issue on the rstudio/blogdown GitHub repo: https://github.com/rstudio/blogdown/issues/358#issuecomment-465752372

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.