pkgdown::build_site()
etc. with muggle defaultsR/pkgdown.R
build_site2.Rd
Sets some muggle defaults for pkgdown to minimize code duplication across
muggle projects.
This includes overrides of _pkgdown.yml
and _site.yml
.
build_site2(run_dont_run = TRUE, override = list(), ...) build_articles2(...) build_article2(...)
run_dont_run | Run examples that are surrounded in \dontrun? |
---|---|
override | An optional named list used to temporarily override
values in |
... | Arguments passed on to
|
build_articles2
: build all articles
build_article2
: build an individual article
These replacement versions of pkgdown functions make the following changes to pkgdown, as applicable:
If there are vignettes/
,
declaring a default vignette rendering function (local_siteyaml()
)
Overriding some values in _pkgdown.yml
by appending override_pkgdownyaml()
) to override
.
Be careful not to provide conflicting overrides.
Sets run_dont_run = TRUE
, so that examples inside \dontrun{}
are still run inside of pkgdown.
Examples often need to be skipped on CRAN and other checks,
though not when building pkgdown.
By default, the top navigation bar (the "navbar") will contain links to:
The home page, with a "home" icon.
"Get Started", if you have an article with the same name as the package
(e.g., vignettes/pkgdown.Rmd
).
Reference
Articles (i.e., vignettes, if present).
News (if present).
A "github" icon with a link to your
github repo (if listed in the DESCRIPTION
url field).
You can override these defaults with the navbar
field. It has two primary
components: structure
and components
. These components interact in
a somewhat complicated way, but the complexity allows you to make minor
tweaks to part of the navbar while relying on pkgdown to automatically
generate the rest.
The structure
defines the layout of the navbar, i.e. the order
of the components, and whether they're right aligned or left aligned.
You can use this component to change the order of the default components,
and to add your own components.
navbar: structure: left: [home, intro, reference, articles, tutorials, news] right: [github]
The components
describes the appearance of each element in the navbar.
It uses the same
syntax as RMarkdown.
The following YAML snippet illustrates some of the most important features.
navbar: components: home: ~ articles: text: Articles menu: - text: Category A - text: Title A1 href: articles/a1.html - text: Title A2 href: articles/a2.html - text: ------- - text: "Category B" - text: Title B1 menu: - text "Sub-category B11" href: articles/b11.html twitter: icon: "fab fa-twitter fa-lg" href: https://twitter.com/hadleywickham
Components can contain sub-menu
s with headings (indicated by missing
href
) and separators (indicated by a bunch of -
). You can also use icon
s
from fontawesome.
This yaml would override the default "articles" component, eliminate
the "home" component, and add a new "twitter" component. Unless you
explicitly mention new components in the structure
they'll be added
to the far right of the left menu.
Other pkgdown functions:
local_siteyaml()
,
override_pkgdownyaml()