Skip to content

Commit ac6c366

Browse files
authored
Merge pull request #23 from sillsdev/FolderNamesWithDashes
Revert to dashes in folder names
2 parents cc93d95 + 1a2fbb9 commit ac6c366

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/HierarchicalNamedLayoutStrategy.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ export class HierarchicalNamedLayoutStrategy extends LayoutStrategy {
1414
context: string,
1515
levelLabel: string
1616
): string {
17-
// The docusaurus documentation doesn't specify how the prefix should look (such that it recognizes and strips it)
18-
// A following dash works.
19-
const prefix = "";
20-
const path = context + "/" + prefix + sanitize(levelLabel); //.replaceAll(" ", "-");
17+
const path = context + "/" + sanitize(levelLabel).replaceAll(" ", "-");
2118

2219
//console.log("Creating level " + path);
2320
const newPath = dirRoot + "/" + path;
2421
fs.mkdirSync(newPath, { recursive: true });
25-
this.addCategoryMetadata(newPath, order);
22+
this.addCategoryMetadata(newPath, order, levelLabel);
2623
return path;
2724
}
2825

@@ -60,8 +57,8 @@ export class HierarchicalNamedLayoutStrategy extends LayoutStrategy {
6057
// "description": "This description can be used in the swizzled DocCard"
6158
// }
6259
// }
63-
private addCategoryMetadata(dir: string, order: number) {
64-
const data = `{"position":${order}}`;
60+
private addCategoryMetadata(dir: string, order: number, label: string) {
61+
const data = `{"position":${order}, "label":"${label}"}`;
6562
fs.writeFileSync(dir + "/_category_.json", data);
6663
}
6764
}

0 commit comments

Comments
 (0)