|
| 1 | +--- |
| 2 | +output: github_document |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- index.md is generated from index.Rmd. Please edit that file --> |
| 6 | + |
| 7 | +```{r} |
| 8 | +#| include: false |
| 9 | +knitr::opts_chunk$set( |
| 10 | + collapse = TRUE, |
| 11 | + comment = "#>", |
| 12 | + tidy = "styler", |
| 13 | + fig.path = "man/figures/README-", |
| 14 | + out.width = "100%" |
| 15 | +) |
| 16 | +``` |
| 17 | + |
| 18 | +# rogtemplate <a href='https://ropengov.github.io/rogtemplate/'><img src="man/figures/logo.png" align="right" height="139"/></a> |
| 19 | + |
| 20 | +<!-- badges: start --> |
| 21 | + |
| 22 | +[](https://ropengov.org/) |
| 24 | +[](https://github.com/rOpenGov/rogtemplate/actions) |
| 26 | +[](https://ropengov.r-universe.dev/rogtemplate) |
| 27 | +[](https://lifecycle.r-lib.org/articles/stages.html#experimental) |
| 28 | + |
| 29 | +<!-- badges: end --> |
| 30 | + |
| 31 | +This package is a **pkgdown** template adapted to |
| 32 | +[rOpenGov](https://ropengov.org/) site. |
| 33 | + |
| 34 | +This is a private template for use by core rOpenGov packages. Please don't use |
| 35 | +it for your own code. |
| 36 | + |
| 37 | +## Using rogtemplate |
| 38 | + |
| 39 | +It is possible to deploy your **pkgdown** site along with **rogtemplate** via CI |
| 40 | +(GitHub Actions) or locally, that provides more control but it is not automatic. |
| 41 | + |
| 42 | +### Option A: Deploy using GitHub Actions |
| 43 | + |
| 44 | +It is not necessary to install **rogtemplate** itself. First copy [this |
| 45 | +file](https://github.com/rOpenGov/rogtemplate/blob/main/inst/yaml/rogtemplate-gh-pages.yaml) |
| 46 | +into your `.github/workflows/` folder. |
| 47 | + |
| 48 | +Next go to *YOUR_GITHUB_REPO\>Settings\>GitHub Pages* and deploy your website |
| 49 | +from the `gh-pages` branch. |
| 50 | + |
| 51 | +### Option B: Deploy installing rogtemplate |
| 52 | + |
| 53 | +You can install **rogtemplate** using the |
| 54 | +[r-universe](https://ropengov.r-universe.dev/rogtemplate): |
| 55 | + |
| 56 | +```{r} |
| 57 | +#| eval: false |
| 58 | +install.packages("rogtemplate", |
| 59 | + repos = c("https://ropengov.r-universe.dev", "https://cloud.r-project.org") |
| 60 | +) |
| 61 | +``` |
| 62 | + |
| 63 | +You can use also the **pak** package: |
| 64 | + |
| 65 | +```{r} |
| 66 | +#| eval: false |
| 67 | +pak::pak("ropengov/rogtemplate") |
| 68 | +``` |
| 69 | + |
| 70 | +You can use `rog_actions_pkgdown_branch()` for setting up the action described |
| 71 | +before but the deployment would be still performed by a GitHub action. |
| 72 | + |
| 73 | +For building locally your package into your `docs` folder use: |
| 74 | + |
| 75 | +```{r} |
| 76 | +#| eval: false |
| 77 | +rogtemplate::rog_build() |
| 78 | +
|
| 79 | +# or you can use also |
| 80 | +
|
| 81 | +rogtemplate::rog_add_template_pkgdown() |
| 82 | +pkgdown::build_site() |
| 83 | +``` |
| 84 | + |
| 85 | +Note that `rogtemplate::rog_add_template_pkgdown()` creates a `_pkgdown.yaml` |
| 86 | +file (or modify an existing one) with the following lines: |
| 87 | + |
| 88 | +:::: code-with-filename |
| 89 | +::: code-with-filename-file |
| 90 | +```{=html} |
| 91 | +<pre><strong>.pkgdown.yaml</strong></pre> |
| 92 | +``` |
| 93 | + |
| 94 | +``` yaml |
| 95 | + |
| 96 | +template: |
| 97 | + bootstrap: 5 |
| 98 | + package: rogtemplate |
| 99 | +``` |
| 100 | +::: |
| 101 | +:::: |
| 102 | +
|
| 103 | +These lines tells **pkgdown** to use **rogtemplate**. |
| 104 | +
|
| 105 | +## Commit to GitHub and deploy |
| 106 | +
|
| 107 | +Last step is commit to GitHub, wait until the GitHub action ends (in the case |
| 108 | +you chose to deploy in that way) and deploy the website via |
| 109 | +*YOUR_GITHUB_REPO\>Settings\>GitHub Pages*. |
| 110 | +
|
| 111 | +## Extras |
| 112 | +
|
| 113 | +We provide also some additional extra functions for creating badges and logos, |
| 114 | +see [Extras](https://ropengov.github.io/rogtemplate/reference/index.html) for |
| 115 | +more info. |
0 commit comments