rotemplate provides a custom pkgdown template for rOpenSci packages. Please don’t use it for your own package if it’s not an rOpenSci package (i.e. only use it for packages listed on https://ropensci.org/packages/).
Inspired by tidytemplate and lockedatapkg.
Run
usethis::use_pkgdown()
And to ensure your website will be automatically deployed from Travis, which we recommend,
usethis::use_pkgdown_travis()
Note that the setup that’ll be recommended by running the function above consists in updating the website on a gh-pages branch with every push, which might bloat your git history. If you want to avoid that, have a look at
- the setup in
magick
repo: the website is only built when there’s a GitHub release, which uses the following code in its.travis.yml
file.
deploy:
provider: script
script: Rscript -e 'pkgdown::deploy_site_github()'
skip_cleanup: true
on:
tags: true
- The Travis-free, Makefile-based setup in
cyphr
repo. The gh-pages branch is created anew each time the website is updated. The website is built locally.
In your _pkgdown.yml
config file make sure to add the following lines
template:
package: rotemplate
To .travis.yml
add a command installing the package template,
i.e. something like
before_cache:
Rscript -e 'remotes::install_cran("pkgdown");remotes::install_github("ropenscilabs/rotemplate").'
Locally, if you want to build and preview the website, you’ll need to
ensure that rotemplate
is installed, and then build your website:
remotes::install_github("ropenscilabs/rotemplate")
pkgdown::build_site()
If your package has no logo of its own, use the rOpenSci hex by running
the code below, but do not necessarily put it in the README as mentioned
by usethis
(your choice). This way the package website will have a
favicon.
usethis::use_logo("https://raw.githubusercontent.com/ropensci/logos/master/stickers/blue_short_hexsticker.png")
# but do not necessarily put it in the README as mentioned by `usethis`,
# your call!
pkgdown::build_favicon()