1
0
mirror of synced 2025-12-23 11:54:18 -05:00

initialize Pages for existing translated paths, not just English paths with localized versions of those paths

This commit is contained in:
Sarah Schneider
2021-07-01 12:13:06 -04:00
parent bedc6371af
commit 0333ea39fb
2 changed files with 5 additions and 5 deletions

View File

@@ -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
})