diff --git a/client/gatsby-config.js b/client/gatsby-config.js index 2e9d5fc7ac..9b47bc4563 100644 --- a/client/gatsby-config.js +++ b/client/gatsby-config.js @@ -1,6 +1,10 @@ const path = require('path'); -const config = require('./config/env'); +const { + clientLocale, + curriculumLocale, + homeLocation +} = require('../config/env'); const { buildChallenges, replaceChallengeNode, @@ -8,12 +12,17 @@ const { } = require('./utils/buildChallenges'); const curriculumIntroRoot = path.resolve(__dirname, './src/pages'); +const pathPrefix = + clientLocale === 'english' || clientLocale === 'chinese' + ? '' + : '/' + clientLocale; module.exports = { siteMetadata: { title: 'freeCodeCamp', - siteUrl: config.homeLocation + siteUrl: homeLocation }, + pathPrefix: pathPrefix, plugins: [ 'gatsby-plugin-react-helmet', 'gatsby-plugin-postcss', @@ -34,7 +43,7 @@ module.exports = { options: { name: 'challenges', source: buildChallenges, - onSourceChange: replaceChallengeNode(config.curriculumLocale), + onSourceChange: replaceChallengeNode(curriculumLocale), curriculumPath: localeChallengesRootDir } }, diff --git a/client/package.json b/client/package.json index 580d886f48..fea2f796e9 100644 --- a/client/package.json +++ b/client/package.json @@ -85,7 +85,7 @@ "license": "MIT", "scripts": { "prebuild": "echo 'Client workers building...' && npm run build:workers && echo 'Client workers ready.' && node ../tools/scripts/build/ensure-env.js", - "build": "node --max_old_space_size=7168 node_modules/gatsby-cli build", + "build": "node --max_old_space_size=7168 node_modules/gatsby-cli build --prefix-paths", "build:workers": "node --max_old_space_size=7168 node_modules/webpack-cli --env.production --config ./webpack-workers.js && echo", "build:workers:debug": "node --max_old_space_size=7168 node_modules/webpack-cli --env.production --config ./webpack-workers.js --progress", "clean": "gatsby clean",