Skip to content

Commit

Permalink
Add pageRef to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Nov 10, 2023
1 parent 61b115b commit 7b65371
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/containers/transform/TransformContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
const previouslyFailed = new Set<string>();

Expand Down Expand Up @@ -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 [, 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);
Expand Down
1 change: 1 addition & 0 deletions src/containers/transform/generateNavigationHierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface NavigationHierarchyNode {
weight: number;
identifier: FileId;
parent?: FileId;
pageRef?: string;
}

export interface NavigationHierarchy {
Expand Down

0 comments on commit 7b65371

Please sign in to comment.