Skip to content

Commit 4775938

Browse files
committed
pathcy patch patcherson
1 parent f38d94c commit 4775938

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

js/copy-to-llm.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,9 @@
1414
return;
1515
}
1616
function buildSlugFromPath(pathname) {
17-
if (!pathname || pathname === '/') {
18-
return 'index';
19-
}
20-
21-
let route = pathname;
22-
17+
let route = pathname || '';
2318
route = route.replace(/^\/+/, '');
24-
if (!route) {
25-
return 'index';
26-
}
27-
2819
const segments = route.split('/').filter(Boolean);
29-
if (!segments.length) {
30-
return 'index';
31-
}
32-
33-
if (segments.length >= 2 && segments[0] === 'ai') {
34-
if (segments[1] === 'pages' || segments[1] === 'categories') {
35-
segments.splice(0, 2);
36-
}
37-
}
38-
3920
const slug = segments
4021
.map((segment) => segment.trim())
4122
.filter(Boolean)
@@ -54,7 +35,7 @@
5435
}
5536

5637
function getMarkdownUrl(slug) {
57-
const pageSlug = slug || 'index';
38+
const pageSlug = slug;
5839
const host = window.location ? window.location.host : '';
5940
const protocol = window.location ? window.location.protocol : 'https:';
6041
return `${protocol}//${host}/ai/pages/${pageSlug}.md`;
@@ -528,4 +509,4 @@
528509
} else {
529510
initialize();
530511
}
531-
})();
512+
})();

0 commit comments

Comments
 (0)