This repository has been archived by the owner on Dec 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add redirects to route visitors from the ScalarDB Community docs site…
… to the ScalarDB docs site (#149) * Create index.tsx * Customize error page message with redirect Customize the error page message with a redirect that points to the ScalarDB docs site. * Add redirects Not sure if the redirects will work until the changes have been merged since redirects in Docusaurus only work in production environments. * Change paragraph break syntax * Add announcement banner about redirect * Add announcement banner about redirect * Refactor redirect * Redirect to same page on ScalarDB docs site; remove timer * Remove individual redirects More user-friendly method for redirects exists in `static/redirect.js`.
- Loading branch information
Showing
2 changed files
with
58 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
const baseUrl = 'https://scalardb.scalar-labs.com'; // Base URL for redirection | ||
// Redirect happens immediately. Otherwise, we can use the following to specify seconds. | ||
// const redirectTime = 10000; // 10,000 milliseconds = 10 seconds | ||
|
||
// Create and style the overlay element. | ||
const overlay = document.createElement('div'); | ||
overlay.style.position = 'fixed'; | ||
overlay.style.top = '0'; | ||
overlay.style.left = '0'; | ||
overlay.style.width = '100%'; | ||
overlay.style.height = '100%'; | ||
overlay.style.backgroundColor = 'rgba(211, 211, 211, 0.8)'; // Light gray with opacity | ||
overlay.style.zIndex = '1000'; | ||
overlay.style.display = 'flex'; | ||
overlay.style.justifyContent = 'center'; | ||
overlay.style.alignItems = 'center'; | ||
|
||
// Create and style the popup element. | ||
const popup = document.createElement('div'); | ||
popup.style.backgroundColor = '#fff'; | ||
popup.style.color = '#000'; | ||
popup.style.padding = '20px'; | ||
popup.style.borderRadius = '8px'; | ||
popup.style.boxShadow = '0 4px 8px rgba(0,0,0,0.2)'; | ||
popup.style.position = 'relative'; | ||
popup.style.zIndex = '1001'; | ||
popup.style.textAlign = 'center'; | ||
|
||
// Add message to the popup. | ||
popup.innerHTML = 'The ScalarDB Community docs site has been merged with the <a href="https://scalardb.scalar-labs.com/docs/latest/">ScalarDB docs site</a>.'; | ||
|
||
// Append popup to overlay. | ||
overlay.appendChild(popup); | ||
|
||
// Append overlay to body. | ||
document.body.appendChild(overlay); | ||
|
||
// Get current path. | ||
const currentPath = window.location.pathname; | ||
|
||
// Set timeout for redirect | ||
setTimeout(function() { | ||
window.location.href = `${baseUrl}${currentPath}`; | ||
},); // Redirect happens immediately. Otherwise, we can specify `redirectTime);` at the end of this line. | ||
}); |