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

add redirects #2204

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading