get_distill_source | R Documentation |
This is a utility function that I use to point to source code on GitHub for my Distill posts, located at https://tdunn.ca/. Credit for the idea goes to Danielle Navarro (https://blog.djnavarro.net/).
get_distill_source( repo = "taylordunn/tdunn", branch = "main", collection = "_posts", date = NULL, slug = NULL, html_tag = TRUE, html_label = "Source code" )
repo |
The GitHub repository, "user/repo-name". |
branch |
Name of the GitHub branch, default "main". |
collection |
Collection to which the post belongs to, default "_posts". |
date |
The date of the post. Typically this will be defined as a
RMarkdown parameter via |
slug |
The URL slug of the post. Typically this will be defined as a
RMarkdown parameter via |
html_tag |
Logical. If |
html_label |
If returning a HTML hyperlink, the text label to display. |
A string of the source code URL, or a HTML hyperlink tag.
date <- "2021-05-18" slug <- "tidytuesday-week-21" get_distill_source(date = date, slug = slug, html_tag = FALSE) get_distill_source(date = date, slug = slug, html_tag = TRUE) get_distill_source(date = date, slug = slug, html_tag = TRUE, html_label = "Custom label")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.