diff --git a/packages/gatsby-plugin-page-creator/src/gatsby-node.ts b/packages/gatsby-plugin-page-creator/src/gatsby-node.ts index 6dff9f2f6e168..7ffe6b65a8a2f 100644 --- a/packages/gatsby-plugin-page-creator/src/gatsby-node.ts +++ b/packages/gatsby-plugin-page-creator/src/gatsby-node.ts @@ -190,11 +190,13 @@ Please pick a path to an existing directory.`, const hasTrailingSlash = derivedPath.endsWith(`/`) const path = createPath(derivedPath, hasTrailingSlash, true) + const modifiedPath = applyTrailingSlashOption(path, trailingSlash) + // We've already created a page with this path - if (this.knownPagePaths.has(path)) { + if (this.knownPagePaths.has(modifiedPath)) { return undefined } - this.knownPagePaths.add(path) + this.knownPagePaths.add(modifiedPath) // Params is supplied to the FE component on props.params const params = getCollectionRouteParams(createPath(filePath), path) // nodeParams is fed to the graphql query for the component @@ -202,8 +204,6 @@ Please pick a path to an existing directory.`, // matchPath is an optional value. It's used if someone does a path like `{foo}/[bar].js` const matchPath = getMatchPath(path) - const modifiedPath = applyTrailingSlashOption(path, trailingSlash) - const componentPath = contentFilePath ? `${absolutePath}?__contentFilePath=${contentFilePath}` : absolutePath