Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MDX routes #6

Merged
merged 2 commits into from
May 2, 2022
Merged

Support MDX routes #6

merged 2 commits into from
May 2, 2022

Conversation

brandonpittman
Copy link
Contributor

@brandonpittman brandonpittman commented May 2, 2022

Since MDX files can be routes, they should be supported.

Closes #5

@brandonpittman
Copy link
Contributor Author

brandonpittman commented May 2, 2022

None of the nested routes work with MDX files. The top-level ones work, but that's Remix's normal behavior. Guess Remix's MDX support is taking precedence.

@kiliman
Copy link
Owner

kiliman commented May 2, 2022

Sorry, I don't use Remix's built-in MDX support, so never tested that... I'll see what I can do.

@kiliman kiliman reopened this May 2, 2022
@kiliman kiliman merged commit 4cfdb08 into kiliman:main May 2, 2022
@kiliman
Copy link
Owner

kiliman commented May 2, 2022

Your patch is working fine for me on nested routes. Update published as v0.3.1

image

image

@brandonpittman
Copy link
Contributor Author

Glad it worked! I’ll add a PR for the migrate tool too.

@brandonpittman
Copy link
Contributor Author

@kiliman

Think I figured out my problem. I wanted to have a /reading and then a bunch of /reading/{...other stuff} routes.

If I don't create a layout in reading, the sub-routes don't render. If I try to just have /reading/index.mdx, that becomes the layout and the sub-routes don't render. But I also can't just have reading.index/index.md. There must be a /reading/{_layout,_route,index} file to get anything to render.

@kiliman
Copy link
Owner

kiliman commented May 2, 2022

If you don't want the parent to be a layout, then you need to suffix it with _.

reading_.whatever.mdx
OR
reading_/whatever/index.mdx

@kiliman
Copy link
Owner

kiliman commented May 2, 2022

Because in flat-routes, . is now the path separator, any flat routes in the default convention must use the _ suffix.

So default convention reading.whatever.mdx must be reading_.whatever.mdx

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.

Doesn't work with MDX files
2 participants