We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2131b4 commit 7ff0a35Copy full SHA for 7ff0a35
packages/documentation-framework/components/example/example.js
@@ -224,8 +224,9 @@ export const Example = ({
224
const cleanPathname = loc.pathname.replace(/\/$/, '');
225
const sourcePath = `/${source}`;
226
227
- // Check if the source is already in the pathname to avoid duplication
228
- if (cleanPathname.includes(sourcePath)) {
+ // Check if the source is already at the end of the pathname to avoid duplication
+ // Using endsWith instead of includes to prevent false positives (e.g., /react-console matching /react)
229
+ if (cleanPathname.endsWith(sourcePath)) {
230
return `${cleanPathname}/${slugger(title)}`;
231
} else {
232
return `${cleanPathname}${sourcePath}/${slugger(title)}`;
0 commit comments