Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (55 sloc) 2.44 KB
title: "Auto-linking"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Linking between pkgdown sites}
```{r, include = FALSE}
collapse = TRUE,
comment = "#>"
## Within a package
pkgdown will automatically link to documentation and articles wherever it's possible to do unabmiguously. This includes:
* Bare function calls, like `build_site()`.
* Calls to `?`, like `?build_site` or `package?pkgdown`.
* Calls to `vignette()`, like `vignette("pkgdown")`
## Across packages
Linking to documentation in another package is straightforward. Just adapt the call in the usual way:
* `purrr::map()`, `MASS::addterm()`.
* `?purrr::map`, `?MASS::addterm`.
* `vignette("other-langs", package = "purrr")`, `vignette("longintro", package = "rpart")`
If pkgdown can find a pkgdown site for the remote package, it will link to it; otherwise it will link to <> for documentation, and CRAN for vignettes. In order for a pkgdown site to be findable, it needs to be listed in two places:
* In the `URL` field in the `DESCRIPTION`, as in
* In the `url` field in `_pkgdown.yml`, as in
When this field is defined, pkgdown generate a public facing
[`pkgdown.yml` file]( that provdies
metadata about the site:
pandoc: '2.2'
pkgdown: 1.3.0
pkgdown_sha: ~
compatibility: compatibility.html
dplyr: dplyr.html
dplyr_0.8.0: future/dplyr_0.8.0.html
dplyr_0.8.0_new_hybrid: future/dplyr_0.8.0_new_hybrid.html
programming: programming.html
two-table: two-table.html
window-functions: window-functions.html
Now, when you build a pkgdown site for a package that links to the dplyr documentation (e.g., `dplyr::mutate()`), pkgdown looks first in dplyr's `DESCRIPTION` to find its website, then it looks for `pkgdown.yml`, and uses the metadata to generate the corect links.
You can’t perform that action at this time.