File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,27 @@ const kebabCase = (string) =>
9
9
. replace ( / \s + / g, '-' )
10
10
. toLowerCase ( ) ;
11
11
12
+ // This is a temporary customization to ensure that the path field is always
13
+ // queryable from the createPages API. We rely on the path for deprecation
14
+ // warnings to inform authors that path is no longer a supported markdown
15
+ // property. Because of Gatsby's type inference from frontmatter properties, the
16
+ // query in createPages fails without this patch if no file contains a 'path'
17
+ // frontmatter property.
18
+ //
19
+ // This patch can be safely removed when removing the deprecation warning in
20
+ // createPages.
21
+ exports . createSchemaCustomization = ( { actions } ) => {
22
+ const { createTypes } = actions ;
23
+
24
+ const typeDefs = `
25
+ type MdxFrontmatter {
26
+ path: String
27
+ }
28
+ ` ;
29
+
30
+ createTypes ( typeDefs ) ;
31
+ } ;
32
+
12
33
exports . createPages = async ( { actions, graphql, reporter } ) => {
13
34
const { createPage, createRedirect } = actions ;
14
35
You can’t perform that action at this time.
0 commit comments