Created
February 16, 2022 13:04
-
-
Save maelle/278d2424baa118467960d463d745f083 to your computer and use it in GitHub Desktop.
glitter-redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgdown_site_folder <- "glitter" | |
glitter_redirect <- function() { | |
'<html> | |
<head> | |
<meta http-equiv="refresh" content="0;URL=https://lvaudor.github.io/glitter/" /> | |
<script language="javascript"> | |
window.location.href = "https://lvaudor.github.io/glitter/" | |
</script> | |
</head> | |
</html>' | |
} | |
replace_one_html <- function(path) { | |
message(sprintf("Rewriting %s!", path)) | |
brio::writeLines(glitter_redirect(), path) | |
} | |
all_html <- fs::dir_ls( | |
pkgdown_site_folder, | |
recurse = TRUE, | |
glob = "*.html" | |
) | |
purrr::walk(all_html, replace_one_html) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment