Skip to content

Document where to declare imports for nested snippets#6440

Open
aicortez wants to merge 2 commits into
mainfrom
alejandro/nested-snippet-imports
Open

Document where to declare imports for nested snippets#6440
aicortez wants to merge 2 commits into
mainfrom
alejandro/nested-snippet-imports

Conversation

@aicortez

@aicortez aicortez commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The reusable snippets page says snippets "can import other snippets" but never says where the import must be declared. Declaring a nested snippet's import in the top-level page instead of the parent snippet silently renders empty content, because each file resolves its own imports — page-level imports don't apply inside imported snippets. Whether it happens to work is import order-dependent, so the same pattern can work on one page and fail on another.

This adds a "Nested snippets" section stating the rule (declare the import in the snippet file that uses the nested snippet), explaining why, and showing a parent/child snippet example. Also links to it from the "Create snippets" section, the only other place nesting is mentioned.

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only changes to create/reusable-snippets.mdx with no runtime, auth, or data impact.

Overview
Documents a common nested snippets pitfall: nested imports must live in the parent snippet file, not on the page that imports the parent, because each MDX file resolves its own imports and page-level imports do not apply inside imported snippet content (which can silently render empty).

Adds a Nested snippets subsection with that rule, a short explanation, and parent/child MDX examples, plus a link from Create snippets where nesting is first mentioned.

Reformats several how-to sections (Import text, variables, snippets with variables, React components) from numbered lists into <Steps> / <Step> blocks for consistency with the new nested-snippet walkthrough.

Reviewed by Cursor Bugbot for commit 44f1f93. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
mintlify 🟢 Ready View Preview Jul 8, 2026, 4:02 PM

@mintlify

mintlify Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
tomee 🟢 Ready View Preview Jul 8, 2026, 4:05 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ethanpalm ethanpalm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants