Need help with GraphQL and Gatsby. Task: separate requests and page generation based on mdx, depending on where the file is located.
Simply put: I have a blog and news on the site. The content for the blog is in one folder, and for the news in the next one. All in mdx format.
Difference: the news has a title, the blog has a header.
Lists for files on different pages, as well as the posts and news themselves, are generated according to their own templates.
Hooks are created to get the data in the appropriate folder.
Problem:
- only 1 hook works, which overwrites the second hook
- post and news pages are generated from all files
Example site: https://github.com/Tecnika/test-site
Sample:
- use different types of files.
--- The idea is good, but not suitable for the original project, maybe there are not enough file types
- use your type
--- The type was created, but it was not possible to bind it to files and all requests for it were empty (the NewsPages type was created, the search for AllNewsPages returned an empty array)
- sorting, filters
--- limit only display list, not page generation
If any of this works in your opinion, then please show me how to do it right.
Need to:
-Generate blog and news lists independently of each other
-Generate pages with posts and news based on their templates
(It is possible to increase the generated pages, for example, a catalog of cats, with pages of cats)