Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
add redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
vabarbosa committed Oct 25, 2023
1 parent 7469ce2 commit 7657094
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'] || {}
Expand Down
11 changes: 11 additions & 0 deletions server/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -182,6 +192,7 @@ export {
TRANSLATIONS,
UNIVERSAL_NOTATIONS,
TOC,
LEARNING_REDIRECTS,
findNextSection,
findPrevSection,
getSectionIndex,
Expand Down

0 comments on commit 7657094

Please sign in to comment.