diff --git a/docusaurus.config.js b/docusaurus.config.js index 096e5c7..96292e3 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -142,6 +142,9 @@ const config = { }), ], ], + scripts: [ + '/redirect.js', // Path to your custom JavaScript file + ], plugins: [ [ @@ -150,22 +153,9 @@ const config = { redirects: [ // This redirect takes the user to the latest version of the English docs when they land on the English versions of the docs site. { - to: '/docs/latest/', + to: 'https://scalardb.scalar-labs.com/docs/latest/', from: ['/', '/docs'], }, - { - to: '/docs/latest/run-non-transactional-storage-operations-through-primitive-crud-interface', - from: '/docs/latest/storage-abstraction', - }, - // Uncomment this line when the docs for 3.14 are released. - // { - // to: '/docs/3.13/run-non-transactional-storage-operations-through-primitive-crud-interface', - // from: '/docs/3.13/storage-abstraction', - // }, - { - to: '/docs/3.12/run-non-transactional-storage-operations-through-primitive-crud-interface', - from: '/docs/3.12/storage-abstraction', - }, ], }, ], @@ -359,14 +349,14 @@ const config = { theme: prismThemes.github, darkTheme: prismThemes.dracula, }, - // announcementBar: { - // id: 'new_version', - // content: - // 'ScalarDB X.X is now available!🥳 For details on what\'s included in this new version, see the release notes.', - // backgroundColor: '#2673BB', - // textColor: '#FFFFFF', - // isCloseable: false, - // }, + announcementBar: { + id: 'new_version', + content: + 'Important: The ScalarDB Community docs site has been merged with the ScalarDB docs site.', + backgroundColor: '#e00000', + textColor: '#ffffff', + isCloseable: false, + }, zoom: { selector: '.markdown :not(em) > img', background: { diff --git a/static/redirect.js b/static/redirect.js new file mode 100644 index 0000000..10b75a6 --- /dev/null +++ b/static/redirect.js @@ -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 ScalarDB docs site.'; + + // 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. +});