cosmicjs / gridsome-source-cosmicjs

Official Gridsome source plugin for Cosmic JS
https://www.npmjs.com/package/gridsome-source-cosmicjs
MIT License
5 stars 1 forks source link

Dash after creating pages from object type #3

Closed josbroers closed 4 years ago

josbroers commented 4 years ago

I have an object type which needs to have a dash in the slug after creating pages with the CosmicjsOverscouting template.

The urls must be similar to this: over-scouting/post1 over-scouting/post2

The code for the plugin is:

{
  use: "gridsome-source-cosmicjs",
  options: {
    bucketSlug: "example",
    objectTypes: [
      overscouting, // I tried 'over-scouting' but the dash is not allowed here
    ],
    apiAccess: {
      read_key: "example"
    }
  }
}

How can I get the dash on the desired place?

tonyspiro commented 4 years ago

Looks like you have the Object Type set as a variable. This needs to be a string, like this:

{
  use: "gridsome-source-cosmicjs",
  options: {
    bucketSlug: "example",
    objectTypes: [
      "over-scouting",
    ],
    apiAccess: {
      read_key: "example"
    }
  }
}
josbroers commented 4 years ago

@tonyspiro thanks for your reply. I made a mistake while adding the code to the issue. I'm using quotes, but still it doesn't work. If I use a dash in the string, it says that over-scouting not exists, but I have to use over.

GraphQLError: Syntax Error: Unexpected Name "CosmicjsOver"

josbroers commented 4 years ago

@tonyspiro You have any idea?

jazibsawar commented 4 years ago

@sir-red-dab this issue has been fixed in the latest version v1.0.6