Skip to content

Commit b167c13

Browse files
authored
fix: account for section-less pages during code redirects (#990)
fixes #985
1 parent 7487ef1 commit b167c13

File tree

1 file changed

+5
-1
lines changed
  • apps/svelte.dev/src/routes/e/tmp/codes.json

1 file changed

+5
-1
lines changed

apps/svelte.dev/src/routes/e/tmp/codes.json/+server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ const codes: Record<string, Record<string, string[]>> = {};
1414

1515
for (const page of reference) {
1616
const grouped: Record<string, string[]> = {};
17-
const sections = page.body.split(/(^|\n)## /g).slice(1);
17+
const sections = page.body.split(/(^|\n)## /g);
18+
19+
if (sections.length > 1) {
20+
sections.shift();
21+
}
1822

1923
for (const section of sections) {
2024
const lines = section.slice(section.startsWith('\n') ? 1 : 0).split('\n');

0 commit comments

Comments
 (0)