Comments (3)
Another way of achieving this is like the following file/folder structure:
|-- src
|-- pages
|-- other-pages.mdx
|-- other-pages
|-- some-other-page.mdx
which should generate the following menu:
other pages (link to: /other-pages)
some other page (link to: /other-pages/some-other-page)
Actually like this approach better to be honest.
Let me know what you think.
from gatsby-mdx-routes.
Hey @Unisphere thanks for raising the issue.
I think the problem here is, originally i had intended this plugin to mirror the directory structure of your project.
In your example above yet-another-page
would actually be a folder.
I think at the moment it would be too complicated to attempt to determine what is a folder and what is a file without using something much more complicated than slug ? true : false
.
I guess the other thing is because the menus array is created recursively it does the same for everything on every loop and to ask it to break the recursive loop based on a condition would require either an additional frontmatter field or some other method of telling it what the special cases are.
In either scenario it makes the code more complicated and potentially makes it harder to use the plugin.
I appreciate your time for raising the issue but i've given it some thought and for now i'm going to mark is as #wontfix
from gatsby-mdx-routes.
Hey @PaulieScanlon , no problem, I understand the constraints. Determining what a folder is would absolutely need more metadata which makes things more confusing indeed.
Cheers!
from gatsby-mdx-routes.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-mdx-routes.