Skip to content

Commit c46fe8c

Browse files
committed
Redirect JS docs when relevant
1 parent ba0771f commit c46fe8c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

website/siteConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ const siteConfig = {
354354
users,
355355
examples,
356356
onPageNav: 'separate',
357+
scripts: ['/js/redirectToNewDoc.js'],
357358
/* path to images for header/footer */
358359
headerIcon: "img/dummy.svg",
359360
footerIcon: "img/icon_50.png",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* This code is not run through any build step! Don't add any fancy stuff
3+
*/
4+
5+
(function() {
6+
var specializedDocsRedirect = {
7+
'interop': 'docs/manual/latest/introduction',
8+
'syntax-cheatsheet': 'docs/manual/latest/overview',
9+
'pipe-first': 'docs/manual/latest/pipe',
10+
'promise': 'docs/manual/latest/promise',
11+
'libraries': 'docs/manual/latest/libraries',
12+
'converting-from-js': 'docs/manual/latest/converting-from-js',
13+
}
14+
var path = window.location.pathname.split('/');
15+
var blogPageFullPath = path.slice(2).join('/')
16+
var page = path[path.length - 1];
17+
18+
if (path[1] === 'docs'
19+
&& page != null
20+
// && page !== 'installation' uncomment to test more easily
21+
) {
22+
if (specializedDocsRedirect[page] != null) {
23+
window.location = 'https://rescript-lang.org/' + specializedDocsRedirect[page]
24+
}
25+
}
26+
})();

0 commit comments

Comments
 (0)