@gridsome/source-filesystem for different content route format but same template/typeName
See original GitHub issueSummary
I wonder if there is a way to allow @gridsome/source-filesystem to accepts content from many directory.
Basic example
Saying I organize my posts in blog
directory and memo
directory. All are markdown and I want to use the same template for them. I would like the route for blog posts are /blog/:slug
and route for memo are /memo/:slug
. How can it done with current plugin config?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Defining Your Routes - Routing - Ember Guides
The application route is entered when your app first boots up. Like other routes, it will load a template with the same name...
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 Free
Top 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
Hi @eneim , you can add as many filesystem sources as you want. Take a look here for an example: https://github.com/gridsome/gridsome.org/blob/master/gridsome.config.js
Hi @rsclarke, @tomtev, @eneim
I found that the simplest solution to this problem is to manually assign the path in the Templates part of the gridsome config using a function
IE, for this plugin setup…
and this function to generate the path…
and this Gridsome config that references the function in the templates object…
and given some markdown files in various subdirectories, i.e. /api and /ui…
You will get content of type Doc at /docs/ui, /docs/api, etc. With the need for only one template (GraphQL type – meaning same query for all docs).