Activates or reconfigures a GitHub Pages site for a project hosted on GitHub. This function anticipates two specific usage modes:
Publish from the root directory of a
gh-pagesbranch, which is assumed to be only (or at least primarily) a remote branch. Typically thegh-pagesbranch is managed by an automatic "build and deploy" job, such as the one configured byuse_github_action("pkgdown").Publish from the
"/docs"directory of a "regular" branch, probably the repo's default branch. The user is assumed to have a plan for how they will manage the content below"/docs".
Arguments
- branch, path
Branch and path for the site source. The default of
branch = "gh-pages"andpath = "/"reflects strong GitHub support for this configuration: when agh-pagesbranch is first created, it is automatically published to Pages, using the source found in"/". If agh-pagesbranch does not yet exist on the host,use_github_pages()creates an empty, orphan remote branch.The most common alternative is to use the repo's default branch, coupled with
path = "/docs". It is the user's responsibility to ensure that thisbranchpre-exists on the host.Note that GitHub does not support an arbitrary
pathand, at the time of writing, only"/"or"/docs"are accepted.- cname
Optional, custom domain name. The
NAdefault means "don't set or change this", whereas a value ofNULLremoves any previously configured custom domain.Note that this can add or modify a CNAME file in your repository. If you are using Pages to host a pkgdown site, it is better to specify its URL in the pkgdown config file and let pkgdown manage CNAME.
See also
use_pkgdown_github_pages()combinesuse_github_pages()with other functions to fully configure a pkgdown site
Examples
if (FALSE) { # \dontrun{
use_github_pages()
use_github_pages(branch = git_default_branch(), path = "/docs")
} # }
