Does Gatsby support generating navigation/menus based on arbitrary nested directory structure?
See original GitHub issueHi.
This is a very basic use case, but believe me, I have been looking whole evening - in docs, on stackoverflow and on google in general. Maybe I don’t know how to phrase the problem correctly.
I have some file structure of arbitrary nesting:
- folder-1
- folder-2
- file-1.md
- file-2.md
- folder-3
-file-3.md
- file-4.md
All these md files successfully generate their respective pages.
But I don’t know how to go about constructing dynamic navigation page based on this file structure, so that whenever this structure changes, the navigation page changes “by itself”:
- folder 1
- folder 2
- file 1
- file 2
- folder 2
- folder 3
- file 3
- file 4
Could someone point me in the right direction? Thanks in advance!!!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Gatsby Project Structure
Inside a Gatsby project, you may see some or all of the following folders and files: Folders /.cache Automatically generated. This folder…
Read more >Tutorial: Flow Apex-Defined Data Types for Salesforce Admins
This post is for Salesforce admins and developers, showing you how you can more easily work together to combine Flows and Apex with...
Read more >Release 2.0.2 Torchbox - Wagtail Documentation
This will create a new folder mysite, based on a template ... For tagging, Wagtail fully supports django-taggit so we recommend using that....
Read more >Gatsby.js - 404 page for nested project - Stack Overflow
I have a Gatsby.js project that I host through Github Pages. ... How to tell GitHub Pages to use the 404 page generated...
Read more >Screenshot of the CubeViz chart visualization component ...
5. The process of rendering a list from arbitrary RDF data within. ... that can be selected, if more than one measurement is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wardpeet I am ok with closing this issue.
I used yaml file do define my catalogues structure.
It’s kind of double the work, but it works and arguably has other benefits, like explicitly defining order of files.
I guess it’s just weird that in the docs it’s not clearly explained what are the good practices on creating menus and tables of contents, unless I missed something?
This was my solution to dynamically generate navigation (only works 2 levels deep). Not a great solution but it works for me
Figured I’d share how I did it.
graphql query:
Logic to structure data -
Should output an array of objects with children arrays.