@gatsby-cloud-pkg/gatsby-cms-extension-base
Advanced tools
Comparing version 0.0.45 to 0.0.46
@@ -25,3 +25,15 @@ "use strict"; | ||
const pathQuery = `query getQualifiedSlug($entryUrl:String) { sitePage( path:{ ${entryUrl ? `regex` : `eq`}:$entryUrl } ) { path } }`; | ||
const pathVariables = entryUrl ? `/${entryUrl}/?$/` : `/`; | ||
const pathVariables = { | ||
entryUrl: `/`, | ||
}; | ||
if (entryUrl) { | ||
/** | ||
* The first "/" is important — it ensures that we look for an exact match for the slug | ||
* | ||
* E.g. if we have a "good-day" slug, we want to find pages with "/good-day" slug | ||
* and not a "/hello-world-what-a-good-day" | ||
*/ | ||
const slugRegex = `/${entryUrl}/?$`; | ||
pathVariables.entryUrl = `/${slugRegex}/`; | ||
} | ||
try { | ||
@@ -36,5 +48,3 @@ const res = yield fetch(`${normalizedPreviewUrl}/___graphql`, { | ||
query: pathQuery, | ||
variables: { | ||
entryUrl: pathVariables, | ||
}, | ||
variables: pathVariables, | ||
}), | ||
@@ -41,0 +51,0 @@ }); |
{ | ||
"name": "@gatsby-cloud-pkg/gatsby-cms-extension-base", | ||
"version": "0.0.45", | ||
"version": "0.0.46", | ||
"private": false, | ||
@@ -49,3 +49,3 @@ "description": "Common utilities for integrating Gatsby Preview with CMS providers", | ||
}, | ||
"gitHead": "a80addbf80a4c9065d5975c6060bc9f8bd246b37" | ||
"gitHead": "b70a73431df7f49d376c7ee7cec8c7178bc4a2f3" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15658
153