I am looking for a little nudge in the right direction for solving some graphql/filesystem/frontmatter/parsing challenges as a newcomer to gatsby...

I have a large collection of nested folders of markdown files for project posts I've generated from a historical django site. I'm using the collection query to query varying page types (blog, project, etc)

The project structure looks something like this and there are about 300 work/project folders in various years:

/content/
    work/
        2000/
            brandname-title/
                index.md
                credits.md
                images.md
                videos.md
                images/
                    index.md
                    gallery1.md
                    gallery1/
                        image1.jpg
                        image2.jpg
                    gallery2.md
                    gallery2/
                        image1.jpg
                        image2.jpg
                videos/
                    index.md
                    video1.md
                    video1/
                        video1.mp4
                        video1.ogv
                    video2.md
                    video2/
                        video2.mp4
                        video2.mov

The blog structure is similar with less media and it's mutable if need be.

I want the index.md file for each project to be it's corresponding page with it's stub/sidecar files not considered as pages but useable as content within the main page. The same goes for subfolders. The index.md file represents the main content and the other stub/sidecar markdown files are used to store the data.

I'm hoping to have the following routes resolve:

2000/                           (all projects from 2000)
2000/brandname-title/           (the index.md file with images, videos, credits)
2000/brandname-title/images/    (gallery1 and gallery2)
2000/brandname-title/videos/    (video1 and video2)

Give me a nudge... linkslap...

1 Answers

1
corvidism On

Never tried that, but if you just need a nudge... I think you'll want to split what gatsby-transformer-remark does (compile Markdown files into html and give you access to it) and what the Gatbsy Node API does (create page routes).

So you would start like the documentation says, then:

  1. in gatsby-config.js you would grab all markdown files, but
  2. in gatsby-node.js create pages just from some of them, then
  3. in your page template use GraphQL to get the content of the "partials".