diff --git a/src/containers/transform/TransformContainer.ts b/src/containers/transform/TransformContainer.ts index 95c8a811..7d185dd1 100644 --- a/src/containers/transform/TransformContainer.ts +++ b/src/containers/transform/TransformContainer.ts @@ -327,9 +327,6 @@ export class TransformContainer extends Container { this.localLinks = new LocalLinks(contentFileService); await this.localLinks.load(); - this.hierarchy = await this.loadNavigationHierarchy(); - await this.writeHugoMenu(this.hierarchy); - const processed = new Set(); const previouslyFailed = new Set(); @@ -404,6 +401,16 @@ export class TransformContainer extends Container { await markdownTreeProcessor.regenerateTree(rootFolderId); await markdownTreeProcessor.save(); + this.hierarchy = await this.loadNavigationHierarchy(); + for (const k in this.hierarchy) { + const item = this.hierarchy[k]; + if (item.identifier) { + const [file, path] = await markdownTreeProcessor.findById(item.identifier); + item.pageRef = path; + } + } + await this.writeHugoMenu(this.hierarchy); + const indexer = new LunrIndexer(); await markdownTreeProcessor.walkTree((page) => { indexer.addPage(page); diff --git a/src/containers/transform/generateNavigationHierarchy.ts b/src/containers/transform/generateNavigationHierarchy.ts index de1cffa6..54f1e72a 100644 --- a/src/containers/transform/generateNavigationHierarchy.ts +++ b/src/containers/transform/generateNavigationHierarchy.ts @@ -9,6 +9,7 @@ export interface NavigationHierarchyNode { weight: number; identifier: FileId; parent?: FileId; + pageRef?: string; } export interface NavigationHierarchy {