A template for rendering R Markdown documents as HTML using the GOV.UK Design System. Can be used for single documents or for websites. font: "sans-serif" favicon: "custom" logo: "images/govdown-logo-white-on-transparent.svg" logo_url: "index.html" logo_text: "govdown" page_title: "page_title" title: "title" phase: alpha feedback_url: "https://github.com/ukgovdatascience/govdown/issues"
govdown_document(
keep_md = FALSE,
font = c("sans-serif", "new-transport"),
favicon = c("none", "custom", "govuk"),
logo = FALSE,
logo_url = "",
logo_text = "Logo text",
page_title = "Page title",
title = "Title",
phase = c("none", "alpha", "beta"),
feedback_url = "404.html",
google_analytics = NULL,
...
)logical, whether to keep the intermediate .md file after
rendering.
one of "sans-serif" (default) or "new-transport". New
Transport must be when the document or website is published on the GOV.UK
domain, otherwise it must not be used.
one of "govuk" (default) or "custom". For websites only,
not standalone documents. If "custom" then image files in the directory
"favicon/" will be used. The filenames are:
apple-touch-icon-152x152.png
apple-touch-icon-167x167.png
apple-touch-icon-180x180.png
apple-touch-icon.png
favicon.ico
mask-icon.svg
See system.file("rmarkdown/resources/favicon-custom.html", package = "govdown") for how the icons are used. See
system.file("rmarkdown/resources/assets/images", package = "govdown") for
the default images. All the files are required.
FALSE (default) or a path to an image file.
URL to follow when the logo is clicked.
Text to place beside the logo.
Text to go inside the <title> tags, used in browser
toolbars, when making bookmarks and in search engine results.
Text to appear in the main part of the bar at the top of every page.
one of "none" (default), "alpha" or "beta" to put an alpha
or beta banner indicating the maturity of the service (if it is a service).
URL for feedback, given in the phase banner when phase
is "alpha" or "beta".
Google Analytics ID for monitoring traffic to the website.
passed on to rmarkdown::html_document_base(), used by Shiny and
rmarkdown::run().
R Markdown output format to pass to rmarkdown::render()
To configure a standalone document, use the yaml at the top of the .Rmd
file.
---
output:
govdown::govdown_document:
font: "sans-serif"
favicon: "custom"
logo: "images/logo.svg"
logo_url: "https://ukgovdatascience.github.io/govdown/"
logo_text: "logo_text"
page_title: "page_title"
title: "title"
phase: alpha
feedback_url: "https://github.com/ukgovdatascience/govdown/issues"
google_analytics: "UA-12345678-90"
---
To configure a website, use a _site.yml file instead.
output_dir: docs # to host on GitHub pages
navbar:
- text: "Home"
href: index.html
- text: "Tech docs"
href: tech-docs.html
- text: "News"
href: NEWS.html
output:
govdown::govdown_document:
font: "sans-serif"
favicon: "custom"
logo: "images/govdown-logo-white-on-transparent.svg"
logo_url: "index.html"
logo_text: "govdown"
page_title: "page_title"
title: "title"
phase: alpha
feedback_url: "https://github.com/ukgovdatascience/govdown/issues"
google_analytics: "UA-45097885-11"
# NOT RUN {
# Requires pandoc version 2+
input_rmd <- system.file("extdata/input.Rmd", package = "govdown")
x <- rmarkdown::render(input_rmd, govdown_document())
y <- rmarkdown::render(input_rmd, govdown_document(phase = "alpha"))
utils::browseURL(x)
utils::browseURL(y)
# }
Run the code above in your browser using DataLab