Skip to content

Commit 2a12a3c

Browse files
committed
go back to ignoring translated paths that do not exist because we cannot initialize a fake translated page using the English base path
1 parent eb44f99 commit 2a12a3c

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

lib/create-tree.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = async function createTree (originalPath, langObj) {
2020
const localizedBasePath = path.posix.join(__dirname, '..', langObj.dir, 'content')
2121

2222
// Initialize the Page! This is where the file reads happen.
23-
let page = await Page.init({
23+
const page = await Page.init({
2424
basePath: localizedBasePath,
2525
relativePath,
2626
languageCode: langObj.code
@@ -29,17 +29,10 @@ module.exports = async function createTree (originalPath, langObj) {
2929
if (!page) {
3030
// Do not throw an error if Early Access is not available.
3131
if (relativePath.startsWith('early-access')) return
32-
// If a translated path doesn't exist, fall back to the English so there is parity between
33-
// the English tree and the translated trees.
34-
if (langObj.code !== 'en') {
35-
page = await Page.init({
36-
basePath: basePath,
37-
relativePath,
38-
languageCode: langObj.code
39-
})
40-
}
41-
42-
if (!page) throw Error(`Cannot initialize page for ${filepath}`)
32+
// Do not throw an error if translated page is not available.
33+
if (langObj.code !== 'en') return
34+
35+
throw Error(`Cannot initialize page for ${filepath} in ${langObj.code}`)
4336
}
4437

4538
// Create the root tree object on the first run, and create children recursively.

0 commit comments

Comments
 (0)