forked from zereight/gitlab-mcp
-
Notifications
You must be signed in to change notification settings - Fork 1
fix(docs): Edit links point to 404 for generated .md files #217
Copy link
Copy link
Labels
Description
Problem
VitePress "Edit this page on GitHub" links lead to 404 errors for pages generated from .md.in templates.
Current config (docs/.vitepress/config.mts:273-276):
editLink: {
pattern: "https://github.com/structured-world/gitlab-mcp/edit/main/docs/:path",
text: "Edit this page on GitHub",
}This generates links like:
https://github.com/.../edit/main/docs/guide/index.md→ 404 (file doesn't exist in repo)
Affected Pages
6 pages are generated from .md.in templates (listed in .gitignore):
| VitePress Page | Source Template | Edit Link Status |
|---|---|---|
/ |
docs/index.md.in |
❌ 404 |
/guide/ |
docs/guide/index.md.in |
❌ 404 |
/guide/authentication |
docs/guide/authentication.md.in |
❌ 404 |
/guide/installation/claude-desktop |
docs/guide/installation/claude-desktop.md.in |
❌ 404 |
/tools/ |
docs/tools/index.md.in |
❌ 404 |
/clients/claude-desktop |
docs/clients/claude-desktop.md.in |
❌ 404 |
All other pages (~50+) work correctly as their .md files are tracked in git.
Additional Issue
docs/clients/claude-desktop.md is missing from .gitignore despite being generated from .md.in template. Should be added to keep consistency.
Solution
VitePress supports editLink.pattern as a function. We can detect templated files and redirect to .md.in:
editLink: {
pattern: ({ filePath }) => {
// Files generated from .in templates
const templatedFiles = [
'index.md',
'guide/index.md',
'guide/authentication.md',
'guide/installation/claude-desktop.md',
'tools/index.md',
'clients/claude-desktop.md',
];
const relativePath = filePath.replace(/^docs\//, '');
const isTemplated = templatedFiles.includes(relativePath);
const targetPath = isTemplated ? `${filePath}.in` : filePath;
return `https://github.com/structured-world/gitlab-mcp/edit/main/${targetPath}`;
},
text: "Edit this page on GitHub",
}Alternative Solutions
- Disable edit links for generated pages — set
editLink: falsein frontmatter of.md.intemplates - Build-time injection — have
inject-tool-refs.tsadd frontmatter to generated files disabling edit link - Custom component — replace default edit link with component that checks for
.md.in
Tasks
- Add
docs/clients/claude-desktop.mdto.gitignore - Implement
editLink.patternfunction to redirect templated files to.md.in - Test all 6 affected pages have correct edit links
References
- VitePress editLink config
inject-tool-refs.ts— script that generates.mdfrom.md.intemplates
Reactions are currently unavailable