The Challenge
Documentation projects (especially Mintlify-targeted ones) are typically designed as standalone sites. They reference images, snippets, and internal pages using absolute paths like/images/logo.png or /guides/quickstart. When you combine multiple projects, these paths collide:
Without intelligent handling
How Mintlify Collections Work
TheMintlifyDocReferenceHandler solves this by performing three key operations during the build process:
Resource Relocation
Shared resource directories (
images/, snippets/) are moved to central locations with project-specific namespacing:Content Path Rewriting
All absolute paths in MDX files are automatically rewritten to reference the relocated resources and prefixed pages:
| Original Path | Rewritten Path |
|---|---|
/images/logo.png | /images/product-1/logo.png |
/snippets/Hero.jsx | /snippets/product-1/Hero.jsx |
/guides/quickstart | /product-1/guides/quickstart |
Supported Path Patterns
The handler rewrites paths in all common MDX patterns:- ES Imports
- Markdown Links & Images
- JSX Attributes
- CSS url()
Paths inside fenced code blocks are not rewritten, ensuring your documentation examples remain accurate.
Output Structure
After processing, your collection has a clean, conflict-free structure:Configuration Example
MyPlatform.docsproj
Best Practices
Use Descriptive Destination Paths
Choose short, URL-friendly names like
product-1 rather than full project names. These become part of every URL in the referenced content.Organize Shared Resources
Keep images and snippets in their respective directories. The handler specifically looks for
images/ and snippets/ folders to relocate.Test Path References
After building, verify that imports, images, and links resolve correctly. Check the browser console for 404 errors.
Keep Code Examples Accurate
Since code blocks aren’t rewritten, your documentation examples will show the original paths - which is usually what you want for copy-paste accuracy.
Comparison with Base Markdown
The Mintlify handler extends the baseMarkdownDocReferenceHandler with additional patterns:
| Feature | Markdown Handler | Mintlify Handler |
|---|---|---|
| Markdown images | Yes | Yes |
| Markdown links | Yes | Yes |
| ES imports | No | Yes |
| JSX src/href | No | Yes |
| CSS url() | No | Yes |
| .mdx files | No | Yes |