Skip to content

Commit 30a7ebc

Browse files
committed
chore: Add redirects for old R pages
```r links <- c( "https://posit-dev.github.io/shinychat/authors.html", "https://posit-dev.github.io/shinychat/LICENSE-text.html", "https://posit-dev.github.io/shinychat/LICENSE.html", "https://posit-dev.github.io/shinychat/news/index.html", "https://posit-dev.github.io/shinychat/reference/chat_append.html", "https://posit-dev.github.io/shinychat/reference/chat_ui.html", "https://posit-dev.github.io/shinychat/reference/index.html" ) links <- sub("https://posit-dev.github.io/shinychat/", "", links) template <- r"---( <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Redirect</title> <script type="text/javascript"> var redirects = {"":"{{redirect}}"}; var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash; var redirect = redirects[hash] || redirects[""] || "/"; window.document.title = 'Redirect to ' + redirect; window.location.replace(redirect); </script> </head> <body> </body> </html> )---" dirs <- fs::path_dir(links) dirs <- unique(dirs[dirs != "."]) dirs <- fs::path("docs", dirs) fs::dir_create(dirs) htmls <- glue::glue( template, redirect = file.path("r", links), .open = "{{", .close = "}}" ) purrr::walk2(links, htmls, function(from, html) { writeLines(html, fs::path("docs", from)) }) ```
1 parent f151339 commit 30a7ebc

File tree

7 files changed

+98
-0
lines changed

7 files changed

+98
-0
lines changed

docs/LICENSE-text.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/LICENSE-text.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/LICENSE.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/LICENSE.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/authors.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/authors.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/news/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/news/index.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/reference/chat_append.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/reference/chat_append.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/reference/chat_ui.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/reference/chat_ui.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

docs/reference/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
<head>
3+
<title>Redirect</title>
4+
<script type="text/javascript">
5+
var redirects = {"":"r/reference/index.html"};
6+
var hash = window.location.hash.startsWith('#') ? window.location.hash.slice(1) : window.location.hash;
7+
var redirect = redirects[hash] || redirects[""] || "/";
8+
window.document.title = 'Redirect to ' + redirect;
9+
window.location.replace(redirect);
10+
</script>
11+
</head>
12+
<body>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)