In Gatsby tutorial part 6, you can find multiple mentions of "node type" :
According to the API, you need to decide on two things before creating a collection route:
- Which type of node to create pages from.
- Which field from that node type to use in the URL.
To create a new collection route, you name your file
{nodeType.field}.js
, wherenodeType
is the type of node you want to create pages from, andfield
is the data field from that node type that you want to use in the URL for that page.
My aim would be to create a page tree like :
index.tsx
blog/{article.slug}.tsx
projects/{project.slug}.tsx
tags/{tag.id}.tsx
All of articles, projects and tags would be MDX files but queried on specific location, or frontmatter prop.
But I don't know how to create named node type that I should use like mdx
in {mdx.slug}.js
.
I even tried to add an instance of gatsby-source-filesystem
with a name
to use as type but it didn't work :
plugins: [
// ...
{
resolve: "gatsby-source-filesystem",
options: {
path: `${__dirname}/_data`,
name: "instances",
__key: 'instances'
}
},
"gatsby-plugin-mdx"
}