-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-filesystem] iterate over specific directories and get files from it #3727
Comments
If you have a specific list of directories, why not include a filter on relativePath in your GraphQL query? |
It's build time determination. Meaning , I can add a new directory with new
content...and the next time I run a Gatsby build, it will pick it up.
…On 28-Jan-2018 02:49, "Sam Bhagwat" ***@***.***> wrote:
If you have a specific list of directories, why not include a filter on
relativePath in your GraphQL query?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3727 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEsU8m3xu0oineU9UjdSYGF8dhdbgLHks5tO5LQgaJpZM4RvN68>
.
|
@sandys this would be a sweet addition to Gatsby! What would need to happen is that we add to the |
hey guys - do the devs have a plan to fix this ? im a new user of gatsbyjs, but am creating a structure where each folder has many subfolders and results in a page constructuted. This could include a bunch of images, yaml files, etc. Would really really appreciate a better file+directory iteration mechanism that has decent integration with graphql. IMHO this has too many integration points for anyone other than core devs to touch it. |
hi guys - any chance for this to be fixed ? We want to generate an internal jobs site with a list of jobs in the front page and each job has its own page. We want to do this in the simplest possible way by creating a bunch of subdirectories inside "/jobs" directory (which can be done by our HR team). As soon as they create a new directory (and put a description.md , photo.jpg files)... it gets compiled to show up on the front page. Removing a job should be as easy as removing a folder. We are not able to figure out how to do this in gatsbyjs graphql. Can someone help please ? |
@vnwarrior why don't you start working on a PR? Happy to help you through the process! Open source happens because someone needs some code so they write it and contribute it and it sounds like you have a great need for it. |
@adityapandey9 can i request you to put your code inside the <code> </code> formatting ? Also - it is not a constantly running build. remember, im trying to make it as simple for non coders to add/remove jobs. so the HR manager (who knows very little coding) has to create a new folder, put some markdown in it and that's it... a new job should come on next build. does your code allow that ? |
…#3727 Signed-off-by: Peter T Bosse II <[email protected]>
I've been thinking about this and wondering why we don't use the parent / child relationship to handle this? Isn't this a textbook case for when to use parent / child? I think the issue is how to you switch allFile and allDirectory to a usage that has parent / child without breaking BC? Do you create a new node type (name TBD, perhaps fileResource? [suggestions appreciated]) such that all directories and files are duplicated in the datalayer or do you create new queries that abstract the fileResource into the allFile and allDirectory queries? 😕 The use case that I have is that I'd like to be able to have gatsby create a directory node and create a grid gallery component out of all of the images in that directory. This doesn't seem to be very possible right now, suggestions welcome. I'd be willing to attempt a PR, but I'd want a couple of the details ironed out before I break ground. |
Believe it or not, there's some pseudo code here that might help: #3129 (comment) |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
This issue is being closed due to inactivity. Is this a mistake? Please re-open this issue or create a new issue. |
@KyleAMathews @ptb |
There are other people with similar issues - https://stackoverflow.com/questions/47313856/executing-graphql-queries-on-the-result-of-another-one
We need run one graphql for a specific list of directories and then on those directories, run another graphql query to get specific files within them. One of the issues is that pull request #2060 does not work. Allfile does not return directories. Second issue is that even if it did, how do i get the files inside it.
In general, one of the big usecases around gatsby is able to build logic around directory structure and use it to generate a static website. The biggest missing piece is being able to traverse directories in a seamless way. Today i can only get one level of either directories or files (and not even both simultaneously).
this will be a huge boost to building complex structures using gatsby
The text was updated successfully, but these errors were encountered: