Chapter 2 Technical Guidelines

This chapter explains the technical details of submitting a blog post or tech note (referred to collectively as “posts”) for publication on the rOpenSci website - from drafting in an (R) Markdown template, to submitting for review using GitHub Pull Request infrastructure.

We include advice on commonly used elements like adding an image, a citation, or embedding a tweet in case you need them.

Briefly, the process is:

  1. Get the go-ahead and a tentative publication date from our Community Manager Stefanie Butland.
  2. Fork the repository (repo) of the rOpenSci website.
  3. Draft your post in R Markdown or Markdown and create or update your author metadata.
  4. Preview and refine your post locally.
  5. Submit via pull request and preview your post.
  6. A blog editor reviews your post.
  7. Revise your post in response to review.

This chapter links to templates for posts and checklists that you can also find in the Appendix.

2.1 Fork the repo and create your post folder

Fork the rOpenSci website repository and create a new branch to work on your post. For help with this aspect of git/GitHub, we recommend happygitwithr and the pull request helpers of the usethis package.

2.2 Start the post from a template

If you use RStudio, refer to the instructions to create your draft with blogdown’s New Post Addin. If not, refer to the instructions to create your draft manually.

2.2.1 Get R Markdown or Markdown template with blogdown’s New Post Addin

The blogdown New Post RStudio addin creates the post draft in the correct location and fills the post YAML based on metadata you’ll have entered.1

  • Install whoami and blogdown: install.packages(c("whoami", "blogdown"))
  • Install Hugo (to preview the post): blogdown::install_hugo()
  • Re-start R
  • In RStudio, open the forked roweb3 project
  • Create a new post by running Addins > New Post or blogdown:::new_post_addin()

blogdown's New Post Addin.

  • Enter a title, no need to worry about title case at this stage.
  • Enter your name if whoami wasn’t able to guess it.
  • Choose the correct date.
  • Enter a new slug if the default one is too long.
  • Choose “blog” or “technotes” as a Subdirectory from the drop-down menu.
  • Choose an Archetype, Rmd or md, from the drop-down menu.
  • Also choose the correct Format: .Rmd if Rmd, Markdown (.md) if md. Never choose .RMarkdown.
  • Ignore Categories.
  • Select any relevant tag and/or create new ones.
  • Click on “Done”, your post draft will have been created and opened.

2.2.2 Get R Markdown or Markdown template manually

Create a folder YYYY-MM-DD-slug/ (e.g. 2020-01-20-rorcid/) under /content/blog/ or content/technotes/ for a blog post and a tech note, respectively. Your post source and its images should live in /content/blog/YYYY-MM-DD-slug/ or /content/technotes/YYYY-MM-DD-slug/.2

  • R Markdown template is to be saved as /content/blog/YYYY-MM-DD-slug/index.Rmd. It will need to be knit (RStudio knit button, or rmarkdown::render(<path_to_file>)). Add both index.Rmd and index.mdto your PR.

  • Markdown template is to be saved as /content/blog/YYYY-MM-DD-slug/

2.3 Walkthrough with code snippets

2.3.1 What goes in YAML

This is the YAML from our post template, with comments to explain some components:

slug: "post-template"
title: Post Title in Title Case
# Delete the package_version line below if your post is not about a package
package_version: 0.1.0
  - Author Name1
  - Author Name2
# Set the date below to the publication date of your post
date: 2020-03-10
# Minimal tags for a post about a community-contributed package 
# that has passed software peer review are listed below
# Consult the Technical Guidelines for information on choosing tags
  - Software Peer Review
  - packages
  - R
  - community
# The summary below will be used by e.g. Twitter cards
description: "A very short summary of your post (~ 100 characters)"
# If you have no preferred image for Twitter cards,
# delete the twitterImg and twitterAlt lines below 
# - Replace "blog" with "technotes" as needed
# - Note "/" between year/month/day
twitterImg: blog/2019/06/04/post-template/name-of-image.png
twitterAlt: "Alternative description of the image"
--- Add subject tags

Add tags to the YAML of your post to make it more findable. Browse our page that lists all tags in use and re-use an existing tag rather than creating a new one e.g. ‘packages’ exists, so use that, rather than ‘package’.

For a post about your peer-reviewed package, use ‘Software Peer Review’, ‘R’, ‘community’, ‘packages’, the package name, tags that were topic labels in your package review such as ‘data-access’, and any others you see fit. Optional Twitter cards metadata

If you’re curious about the description, twitterImg, twitterAlt YAML fields in the post metadata and how they can help draw readers to your post, refer to our explanation of Twitter cards.

Delete description, twitterImg and twitterAlt YAML fields if you don’t use them.

2.3.2 Examples

Comparing the raw Markdown to the live posts in these examples might be helpful.

2.3.3 To add an image

If your blog post has any images that are not generated from R Markdown, put them in the same folder as your post source (/content/blog/YYYY-MM-DD-slug/ or /content/technotes/YYYY-MM-DD-slug/). All non-R Markdown images should be in this folder (do not link to external services like imgur). To reference them in your post, use name-of-image.png. If your image is e.g. an hex logo, it might look better with a transparent background because the blog background is not exactly white.

Every image should be accompanied by alternative text (alt="informative description") to make it more accessible to people with disabilities and provide a better user experience for everyone. The alternative text should convey the meaning or content that is displayed in the image. Refer to this tutorial for details on what should go in alternative text.

If you want to generate images from R Markdown use our R Markdown template and see next subsection.

Insert an image

  • Insert an image with either figure or imgtxt short codes
    • {{< figure src = "image-name.png" alt = "informative description" >}}
    • {{< imgtxt src = "image-name.png" alt = "informative description">}} Text to right {{< /imgtxt >}}

Image placement

  • Basic positioning with {{< figure >}} and class

    {{< figure src = "image-name.png" alt = "informative description" class = "center" >}}

    • pull-left - Left-align the picture and wrap text around it
    • center - Center the picture (no text wrapping)
    • pull-right - Right-align the picture and wrap text around it

  • Specific text next to image with {{< imgtxt >}}

    {{< imgtxt src = "image-name.png">}} Text to right {{</ imgtxt >}} Text below

    • Only text between {{< imgtxt >}} and {{</ imgtxt >}} is to the right of the figure

  • For images side-by-side, create a composite and insert as a single image
    • Consider gimp for free and open source image manipulation software
    • Consider the R package patchwork for combining R figures

Other details

  • Control image size with width
    {{< figure src = "image-name.png" width = "400" alt = "informative description">}}

  • Make the image a hyperlink with link
    {{< figure src = "image-name.png" alt = "informative description" link = "http://hyperlink">}}

  • For very large images, consider image compression such as TinyPNG

Important! In R Markdown (i.e. in *.Rmd files but NOT *.md files), these Hugo shortcodes need to be escaped:

{{< figure src = "name-of-image.png" width = "400" alt = "informative description">}}

2.3.4 To add a figure generated with R

When using our R Markdown template the knitr hook in the setup chunk actually creates the necessary Hugo shortcodes. Therefore you don’t need to worry about paths.

In the chunk producing a figure, use the hugoopts chunk option to control the alternative text and other elements. hugoopts is a named list that can have all elements described in the documentation of the Hugo figure shortcode except for title.

```{r chunkname, hugoopts=list(alt="alternative text please make it informative", caption="this is what this image shows, write it here or in the paragraph after the image as you prefer", width=300)} 

This chunk above produces a figure with “alternative text please make it informative” as alternative text, “title of the image” as title, “this is what this image shows, write it here or in the paragraph after the image as you prefer” as caption, and a width of 300 pixels.

2.3.5 To add a citation

To add citations, refer to them in the body of your post:

Citation of the primary literature[^1].
Citation of an R package[^2].
Citation of a website[^3].

And list your sources at the bottom of your post:

[^1]: Sciaini, M., Fritsch, M., Scherer, C., & Simpkins, C. E. (2018). NLMR and landscapetools: An integrated environment for simulating and modifying neutral landscape models in R. Methods in Ecology and Evolution, 9(11), 2240-2248. <>
[^2]: Elin Waring, Michael Quinn, Amelia McNamara, Eduardo Arino de la Rubia, Hao Zhu and Shannon Ellis (2019). skimr: Compact and Flexible Summaries of Data. R package version 2.0.2.
[^3]: Hugo static site generator. How to find citation text for a package or article

To get the citation for an R package, run citation("packagename").

To get the citation for an article, you can use the RStudio Addin for rcrossref, or get the citation from a paper’s DOI by running e.g.

rcrossref::cr_cn("10.1111/2041-210X.13076", format="text", style="apa")

[1] "Sciaini, M., Fritsch, M., Scherer, C., & Simpkins, C. E. (2018). NLMRandlandscapetools: An integrated environment for simulating and modifying neutral landscape models inR. Methods in Ecology and Evolution, 9(11), 2240–2248. doi:10.1111/2041-210x.13076"

To get the citation for an article in Google Scholar, find the article, click the quote symbol (in search results under the article) to open the “Cite” window, and copy the APA style text.

Get a citation from Google Scholar.

2.3.6 To embed a tweet

Use a Hugo shortcode to embed a tweet using its ID e.g. {{< tweet 1138216112808529920 >}}. In R Markdown, shortcodes need to be html escaped, refer to the template for an example.

2.4 Style Guide

  • For formatting of package names, functions, and code, follow the tidyverse style guidance. Format package names as regular text (no quotes).
  • Do not use markdown in titles (but you can use them in headings).
  • Use ## and ### to format headings in your post, i.e. section titles as ## (h2) and subsections as ### (h3), #### (h4).
  • Use title case for the title of your post; use sentence case for headings inside the post.
  • ‘rOpenSci’ not ‘ROpenSci’
  • When adding rOpenSci links to your post, use relative instead of absolute URLs e.g. /blog/ instead of
  • When linking to rOpenSci packages use their URL, e.g.
  • Use Hugo shortcodes (not html) to add images, tweets, gists etc.
  • In R Markdown wrap Hugo shortcodes between html preserve tags as shown in the template.
  • Instead of using html widgets (DT, leaflet, etc.), include a screenshot and use the link option of the Hugo figure shortcode to direct readers to an online version of the widget.
  • Use informative alternative text for all images.
  • Add new line at end of each sentence (makes diffs easier to interpret and easier for editor to suggest specific changes).

2.5 Create or update your author file

2.5.1 Why?

The rOpenSci website has a page listing all authors who have contributed to a blog post, tech note, or presented in a Community Call. A click on your by-line in a post takes the reader to your author page that has links to your online home, possibly your Twitter or GitHub profile(s), and a list of all the content you’ve authored on our site. For staff and leadership team members, editors for software peer review, or members of our Code of Conduct Committee, their rOpenSci title is also listed on their author page.

2.5.2 How?

If you don’t already have an author page, create a folder called yourfirstname-yourlastname in your local copy of roweb3/content/author/. You can have accents, middle initials, or hyphens appear in your name if you name your folder appropriately. That can be tricky so we have examples below.

In that folder, create a file called with information about your online presence. You can copy this template below (or get it via roblog after installing it via install.packages("roblog", repos = "") ).

name: Author Name
link: website URL or other online presence
twitter: Twitter username
github: GitHub username
gitlab: GitLab username
keybase: Keybase ID
orcid: ORCID ID

At minimum, provide your name and a link or your Twitter, GitHub, or GitLab username. Add your usernames or ID’s without the “@” or the “https:…”. The link field can be your personal website URL, for example.

2.5.3 Examples

This author file, /author/kelly-obriant/

name: Kelly O'Briant
twitter: kellrstats
github: kellobri

… generates Kelly O’Briant’s author page

Screenshot of Kelly O'Briant's author page

This author file, /author/maëlle-salmon/

name: Maëlle Salmon
twitter: ma_salmon
bio: rOpenSci Research Software Engineer, Associate editor of rOpenSci Software Peer Review
github: maelle
gitlab: maelle
keybase: maelle_salmon
orcid: 0000-0002-2815-0399

… generates Maëlle Salmon’s author page.

For an example of how to name the folder with an accent and initials, see this author file that generates Richèl J.C. Bilderbeek’s author page. The folder name must include accents, initials with periods, and hyphens for spaces, in order to link to their blog content.

Look at other people’s folder names for examples.

2.6 Pre-submission checks

You can use functions in the roblog package to do some automated checks on your post.

  • ro_lint_md() to check and enforce use of complete alternative descriptions for image, of relative links to rOpenSci website, of Hugo shortcodes for tweets, of lower camelCase for rOpenSci name
  • ro_check_urls() to check for URLs that might be broken

In the first comment of your pull request submitting a post, please copy-paste the checklist corresponding to your post (hover, a copy-paste button will appear at the top-right corner of the shaded area) and check off items.

2.6.1 Checklist for a post about a peer-reviewed package

* [ ] I have read the Content Guidelines.
* [ ] I have read the Technical Guidelines.
* [ ] I used or followed the R Markdown or Markdown template.
* [ ] I have followed the Style Guide.
* [ ] I created or updated my author metadata with correct folder name.
* [ ] I have added relevant tags after browsing existing tags.
* [ ] I ran `roblog::ro_lint_md()` on (optional).
* [ ] I ran `roblog::ro_check_urls()` on (optional).
* [ ] I ran a spell-check on
* [ ] I have added the tags - Software Peer Review, my-packagename, R.
* [ ] I have added the package-version YAML tag.
* [ ] I have added acknowledgement of the reviewers' work.
* [ ] I have added a link to the software peer review thread.
* [ ] I ran a spell-check on

2.6.2 Checklist for any other post

* [ ] I have read the Content Guidelines.
* [ ] I have read the Technical Guidelines.
* [ ] I used or followed the R Markdown or Markdown template.
* [ ] I have followed the Style Guide.
* [ ] I created or updated my author metadata with correct folder name.
* [ ] I have added relevant tags after browsing existing tags.
* [ ] I ran `roblog::ro_lint_md()` on (optional).
* [ ] I ran `roblog::ro_check_urls()` on (optional).
* [ ] I ran a spell-check on

2.7 Submit your draft post

Once you’ve drafted your blog post, you can preview locally using Hugo (recommended) or skip to the next step to make a pull request and preview that.

2.7.1 Local preview with Hugo

If you wish to preview your post locally, as it will appear in our site, you must install Hugo. To install, refer to Hugo docs or run blogdown::install_hugo().

Then run hugo serve in the repo directory to start a local server on http://localhost:1313.

The version of Hugo used by the rOpenSci web server is defined in netlify.toml.

When this preview looks good to you, you should submit your post as a pull request.

2.7.2 Make a pull request

If using the R Markdown template, knitting index.Rmd (RStudio knit button, or rmarkdown::render(<path_to_file>)) will generate both and index.html. index.html will be ignored; do commit both index.Rmd and

  • Open a draft pull request (PR) from your fork (using the web interface, see step 8 for creating a draft), or usethis::pr_push() that will save you some work and that will in the end open the same web interface where you can choose Draft PR in the last step)

  • Mark the draft PR as ready for review at least one week prior to the planned publication date. A review from blog editor(s) will be automatically requested by GitHub.

  • If you opened a PR instead of a draft PR, the PR can’t go back to a draft stage but no problem, only make sure to add a comment to the PR mentioning @ropensci/blog-editors once to tell them the PR isn’t ready for review, and another comment later (again mentioning @ropensci/blog-editors) to tell them the PR is really ready for review.

From the PR, Netlify will start building the new version of the site within seconds and you can preview your changes to make sure everything looks as intended. Otherwise push additional fixes till things look right.

Some checks haven't completed yet.

All checks have passed.

  1. If you don’t use RStudio you can still use the addin, but the new post will be opened in the editor returned by getOption("editor"), that you might need to configure.↩︎

  2. In Hugo speak, we’d say your post is a leaf bundle.↩︎