GithubHelp home page GithubHelp logo

Comments (3)

that-joao avatar that-joao commented on June 25, 2024

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.

PaulieScanlon avatar PaulieScanlon commented on June 25, 2024

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.

that-joao avatar that-joao commented on June 25, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.