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

Dynamic slug conflict with plugin and store #641

Open
Zyles opened this issue Sep 4, 2019 · 0 comments
Open

Dynamic slug conflict with plugin and store #641

Zyles opened this issue Sep 4, 2019 · 0 comments

Comments

@Zyles
Copy link

Zyles commented Sep 4, 2019

If I use :slug on a plugin and in the store I will get a conflict problem.

Is it possible to make this work together?

"gridsome": "^0.6.9"
"@gridsome/source-filesystem": "^0.5.0"
gridsome.server.js
module.exports = function (api) {
  api.loadSource(store => {
    const contentType = store.addContentType({
      typeName: 'InfoPage',
      route: '/:slug'
    })

    for (const item of infoPages) {
      contentType.addNode({
        title: item.title,
        content: item.content,
        path: `${item.slug}`
      })
    }
  })
gridsome.config.js
plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: 'content/*.md',
        typeName: 'ContentPage',
        route: '/:slug'
      }
    }
  ]

When visiting the website it will first look at plugin slug for typeName ContentPage and give an error (not 404).

But it does not exist since the slug is pointing to the store InfoPage instead.

Ideally Gridsome should know where the slug should point to, if it is a plugin or a store or a page etc.

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

No branches or pull requests

1 participant