initialize Pages for existing translated paths, not just English paths with localized versions of those paths
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
const fs = require('fs').promises
|
||||
const path = require('path')
|
||||
const Page = require('./page')
|
||||
const basePath = path.posix.join(__dirname, '..', 'content')
|
||||
|
||||
module.exports = async function createTree (originalPath, langObj) {
|
||||
const basePath = path.posix.join(__dirname, '..', langObj.dir, 'content')
|
||||
|
||||
// On recursive runs, this is processing page.children items in `/<link>` format.
|
||||
// If the path exists as is, assume this is a directory with a child index.md.
|
||||
// Otherwise, assume it's a child .md file and add `.md` to the path.
|
||||
@@ -16,11 +17,10 @@ module.exports = async function createTree (originalPath, langObj) {
|
||||
}
|
||||
|
||||
const relativePath = filepath.replace(`${basePath}/`, '')
|
||||
const localizedBasePath = path.posix.join(__dirname, '..', langObj.dir, 'content')
|
||||
|
||||
// Initialize the Page! This is where the file reads happen.
|
||||
const page = await Page.init({
|
||||
basePath: localizedBasePath,
|
||||
basePath: basePath,
|
||||
relativePath,
|
||||
languageCode: langObj.code
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user