Skip to content

Commit b749b47

Browse files
authored
fix(nx-dev): ensure og image is generated for all docs (#18617)
1 parent d1ffe58 commit b749b47

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

scripts/documentation/open-graph/generate-images.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,30 @@ const targetFolder: string = resolve(
3636
);
3737

3838
const data: { title: string; content: string; filename: string }[] = [];
39-
documents.map((category) => {
39+
documents.forEach((category) => {
4040
data.push({
4141
title: category.name,
4242
content: category.description,
4343
filename: [category.sidebarId, category.id].filter(Boolean).join('-'),
4444
});
45-
category.itemList.map((item) =>
45+
category.itemList.forEach((item) => {
4646
data.push({
4747
title: item.name,
48-
content: category.name,
48+
content: item.description || category.name,
4949
filename: [category.sidebarId, category.id, item.id]
5050
.filter(Boolean)
5151
.join('-'),
52-
})
53-
);
52+
});
53+
item.itemList?.forEach((subItem) => {
54+
data.push({
55+
title: subItem.name,
56+
content: subItem.description || category.name,
57+
filename: [category.sidebarId, category.id, item.id, subItem.id]
58+
.filter(Boolean)
59+
.join('-'),
60+
});
61+
});
62+
});
5463
});
5564
packages.map((pkg) => {
5665
data.push({
@@ -137,7 +146,7 @@ function splitLines(
137146
if (words.length <= 1) {
138147
return words;
139148
}
140-
const lines = [];
149+
const lines: string[] = [];
141150
let currentLine = words[0];
142151

143152
for (let i = 1; i < words.length; i++) {

0 commit comments

Comments
 (0)