Skip to content
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

Posts are included in the projects section #217

Closed
hichemfantar opened this issue Jul 8, 2022 · 2 comments · Fixed by #218
Closed

Posts are included in the projects section #217

hichemfantar opened this issue Jul 8, 2022 · 2 comments · Fixed by #218

Comments

@hichemfantar
Copy link
Contributor

hichemfantar commented Jul 8, 2022

I don't understand why this is happening, the hosted version of the website doesn't have this issue but in dev mode I keep getting posts included with projects. Same bug when I produce a production build.
Currently, the only solution I found is to completely delete the posts files.

image

Edit: It seems that everything is being included in the projects query, the regex filter isn't working apparently.

@hichemfantar
Copy link
Contributor Author

hichemfantar commented Jul 8, 2022

Apparently this is a bug with gatsby gatsbyjs/gatsby#7463
My dev folder is called projects and since fileAbsolutePath is using root path then It's matching with all folders because they all belong in the projects folder.
image

Edit: alright I don't think this is a bug, I just just have to use relative path instead of absolute path but I can't find the relativepath property anywhere. Perhaps there's a plugin for it.

@hichemfantar
Copy link
Contributor Author

I found a workaround, I just moved the project to a path that doesn't have the word projects in it.
Now it only detects the projects folder inside the project.
One other workaround would be to be more specific in the projects fileAbsolutePath regex:
projects: allMarkdownRemark( filter: { fileAbsolutePath: { regex: "/content/projects/" } frontmatter: { showInProjects: { ne: false } } }
Instead of
projects: allMarkdownRemark( filter: { fileAbsolutePath: { regex: "/projects/" } frontmatter: { showInProjects: { ne: false } } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant