View source: R/createRedirects.R
createRedirects | R Documentation |
Create HTML pages to redirect users to the latest version of the relevant Bioconductor book. This is useful for preserving compatibility with old links when reorganizing the contents of a book.
createRedirects(
name,
pkg,
page,
dir = "../inst/doc/book",
file = NULL,
check = FALSE,
include.gif = TRUE
)
name |
Character vector containing the name of each HTML. |
pkg |
Character vector containing the name of the Bioconductor book package to redirect to. |
page |
Character vector containing the name of the new chapter to redirect to. |
dir |
String containing the path to the output directory for the HTMLs. |
file |
String containing the name of a comma-separate file with three unnamed columns, from which to derive |
check |
Logical scalar indicating whether to check if the destination URL exists. |
include.gif |
Logical scalar indicating whether a GIF should be included in the redirection notice. |
This function is intended to be called inside the Makefile generated by configureBook
,
which will create the necessary HTMLs at package build time.
The expectation is that there is a file like redirect.txt
that can be passed in as the file
argument.
The default dir
is the same as the final destination for all HTMLs that is defined in the Makefile.
In file
, the last column can be left empty for any row.
This will instruct createRedirects
to re-use name
as page
,
which is convenient when a chapter is simply moved to another package without a change in the HTML file name.
It is probably a good idea to run with check=TRUE
on occasion, to verify that the redirections are working.
This is not done by default to avoid a chicken-and-egg situation where two books cannot build because they redirect to each other.
HTMLs of the specified name
are created in dir
, redirected to the sites defined by their respective pkg
and page
entries.
A NULL
is invisibly returned.
Aaron Lun
tmp <- tempfile()
dir.create(tmp)
createRedirects("BLAH.html", pkg="OSCA.intro", page="installation.html", dir=tmp)
if (interactive()) {
browseURL(file.path(tmp, "BLAH.html"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.