Allow deploy_to_branch()
to deploy to a configurable subdirectory of the branch
#2001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a small PR to add a
subdir
argument todeploy_to_branch()
. By default (as currently)deploy_to_branch()
deploys the packge documentation into the root of a branch, typically an orphangh-pages
branch.When
subdir
is provided,deploy_to_branch()
will set up the git worktree the same as before, but will build the site into the requestedsubdir
of the branch. This enables a variety of site structures, but the two I'm most excited about are:Enabling PR previews via GitHub Actions by building the site preview into
preview/pr${{ github.event.pull_request.number }}
.Enabling documentation for multiple package versions, for example based on tags, by building the site into separate folders, e.g.
subdir = "v2"
andsubdir = "v3"
.As part of the process, we also append the subdir to
pkg$meta$url
, e.g.https://pkg.example.com/v2
. To facilitate that change, I moved theas_pkgdown()
call intodeploy_to_branch()
, which required also overriding the destination here rather than inbuild_site_github_pages()
.