From 765709407975fc27cd4076baa53e7f82149c011a Mon Sep 17 00:00:00 2001 From: //va Date: Wed, 25 Oct 2023 01:59:44 -0400 Subject: [PATCH] add redirects --- server/app.ts | 5 +++-- server/utilities.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/server/app.ts b/server/app.ts index 6b9a578d0..729f76114 100644 --- a/server/app.ts +++ b/server/app.ts @@ -14,7 +14,7 @@ import { LOCALES, translate } from '@mathigon/studio/server/utilities/i18n' import { generateMockData } from './populate-database' import { - CONFIG, NOTATIONS, TEXTBOOK_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, + CONFIG, NOTATIONS, TEXTBOOK_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, LEARNING_REDIRECTS, findNextSection, findPrevSection, getSectionIndex, isLearningPath, updateGlossary, loadLocaleRawFile, tocFilterByType, removeVersionPrefix } from './utilities' @@ -138,7 +138,8 @@ const start = () => { .accounts() .redirects({ '/': TEXTBOOK_HOME, - '/textbook': TEXTBOOK_HOME + '/textbook': TEXTBOOK_HOME, + ...LEARNING_REDIRECTS }) .get('/locales/:locale', (req, res) => { const translations = TRANSLATIONS[req.params.locale || 'en'] || {} diff --git a/server/utilities.ts b/server/utilities.ts index aff450676..12a332df8 100644 --- a/server/utilities.ts +++ b/server/utilities.ts @@ -24,6 +24,16 @@ import { import { IS_PRODUCTION } from './configuration' const TEXTBOOK_HOME = 'https://qiskit.org/learn' +const LEARNING_HOME = 'https://learning.quantum-computing.ibm.com' + +const LEARNING_REDIRECTS = { + '/course/algorithm-design': `${LEARNING_HOME}/course/variational-algorithm-design`, + '/course/algorithm-design/*': `${LEARNING_HOME}/course/variational-algorithm-design`, + '/course/basics': `${LEARNING_HOME}/course/basics-of-quantum-information`, + '/course/basics/*': `${LEARNING_HOME}/course/basics-of-quantum-information`, + '/course/algorithms': `${LEARNING_HOME}/course/fundamentals-of-quantum-algorithms`, + '/course/algorithms/*': `${LEARNING_HOME}/course/fundamentals-of-quantum-algorithms` +} // NOTE: if changing this also update the same variable in 'converter/common.ts' const LATEST_TEXTBOOK_VERSION = 'v2' @@ -182,6 +192,7 @@ export { TRANSLATIONS, UNIVERSAL_NOTATIONS, TOC, + LEARNING_REDIRECTS, findNextSection, findPrevSection, getSectionIndex,