You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-40Lines changed: 43 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,12 @@ This repo contains a [Gatsby v2 source plugin](https://www.gatsbyjs.org/docs/rec
10
10
You can use the plugin in any of the following ways:
11
11
12
12
* Install the [gatsby-source-kentico-cloud](https://www.npmjs.com/package/gatsby-source-kentico-cloud) NPM package in your Gatsby site via `npm install --save gatsby-source-kentico-cloud`.
13
-
*(Coming soon) Use the [gatsby-starter-kentico-cloud](https://github.com/Kentico/gatsby-starter-kentico-cloud) starter site, which uses the NPM package.
13
+
* Use the [gatsby-starter-kentico-cloud](https://github.com/Kentico/gatsby-starter-kentico-cloud) starter site, which uses the NPM package.
14
14
15
15
### Features
16
16
17
+
**Breaking change: All Kentico Cloud content element values now reside inside of the `elements` property of `kenticoCloudItem` nodes.**
18
+
17
19
The plugin creates GraphQL nodes for all Kentico Cloud content types, content items, and language variants.
18
20
19
21
The node names are prefixed with `kenticoCloud`. More specifically, content type nodes are prefixed with `kenticoCloudType` and content items and their language variants are prefixed with `kenticoCloudItem`.
@@ -22,23 +24,33 @@ The plugin creates the following relationships among the Kentico Cloud nodes. Yo
22
24
23
25
#### Content item <-> content type relationships
24
26
25
-
This relationship is captured in the `contentItems` navigation property of all *content type*nodes. For all *content item* nodes, it can be found in the `contentType` navigation property.
27
+
This relationship is captured in the `contentItems` navigation property of all `kenticoCloudType`nodes. In the opposite direction, in all `kenticoCloudItem` nodes, it can be found in the `contentType` navigation property.
26
28
27
-
You can use the GraphiQL interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `kenticoCloudItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:
29
+
You can use the GraphiQL interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKenticoCloudItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:
28
30
29
31
{
30
-
kenticoCloudItemProjectReference {
31
-
name___teaser_image__name {
32
-
value
32
+
allKenticoCloudItemProjectReference {
33
+
edges {
34
+
node {
35
+
elements {
36
+
name___teaser_image__name {
37
+
value
38
+
}
33
39
}
34
-
contentType {
35
-
elements {
36
-
codename
40
+
contentType {
41
+
elements {
42
+
name___teaser_image__name {
43
+
name
37
44
}
45
+
}
38
46
}
39
-
}
47
+
}
48
+
}
49
+
}
40
50
}
41
51
52
+
This kind of relationship comes handy when no content item has a particular element populated with data. In that case Gatsby won't recognize that element and won't include it in its internal schema. Neither the (null) value nor the name of the element will be visible through the `kenticoCloudItem` GraphQL nodes. Tapping into the related `kenticoCloudType` GraphQL node might be a proper fallback mechanism.
53
+
42
54
#### Language variant relationships
43
55
44
56
This relationship is captured by the `otherLanguages` navigation property of all content item nodes. For instance, you can get the names of all content items of the *Speaking engagement* type (by querying `kenticoCloudItemSpeakingEngagement`) in their default language as well as other languages all at once:
@@ -47,14 +59,18 @@ This relationship is captured by the `otherLanguages` navigation property of all
47
59
allKenticoCloudItemSpeakingEngagement {
48
60
edges {
49
61
node {
50
-
name {
51
-
value
52
-
}
53
-
otherLanguages {
62
+
elements {
54
63
name {
55
64
value
56
65
}
57
66
}
67
+
otherLanguages {
68
+
elements {
69
+
name {
70
+
value
71
+
}
72
+
}
73
+
}
58
74
}
59
75
}
60
76
}
@@ -68,13 +84,8 @@ Each modular content property is accompanied by a sibling property suffixed with
68
84
allKenticoCloudItemProjectReference {
69
85
edges {
70
86
node {
71
-
related_project_references {
72
-
name___teaser_image__name {
73
-
value
74
-
}
75
-
}
76
-
related_project_references_nodes {
77
-
name___teaser_image__name {
87
+
elements {
88
+
related_project_references {
78
89
value
79
90
}
80
91
related_project_references_nodes {
@@ -94,15 +105,17 @@ As with the previous example, all rich text properties with modular content also
94
105
allKenticoCloudItemBlogpostReference {
95
106
edges {
96
107
node {
97
-
name___teaser_image__name {
98
-
value
99
-
}
100
-
summary {
101
-
value
102
-
}
103
-
summary_nodes {
104
-
system {
105
-
codename
108
+
elements {
109
+
name___teaser_image__name {
110
+
value
111
+
}
112
+
summary {
113
+
value
114
+
}
115
+
summary_nodes {
116
+
system {
117
+
codename
118
+
}
106
119
}
107
120
}
108
121
}
@@ -118,16 +131,6 @@ All nodes have a `usedByContentItems` property that reflects the other nodes in
118
131
119
132
*[Node.js](https://nodejs.org/) with NPM installed
120
133
121
-
### Troubleshooting
122
-
123
-
In case you encounter the following error:
124
-
125
-
`GraphQL Error Unknown field 'system' on type '...'`
126
-
127
-
just rebuild the site using `npm run develop` or (if you have the Gatsby CLI installed) `gatsby develop`.
128
-
129
-
This [error](https://github.com/gatsbyjs/gatsby/issues/8053) occurs mostly due to issues with building of the internal schema. If it cannot be solved by rebuilding with `npm run develop` or raising the `version` field in the [package.json](https://github.com/Kentico/gatsby-source-kentico-cloud/blob/master/package.json) of the source plugin, then you should look for other root causes (not related to [building of the schema](https://github.com/gatsbyjs/gatsby/issues/2674#issuecomment-340510736)).
130
-
131
134
## Further information
132
135
133
136
For more developer resources, visit the Kentico Cloud Developer Hub at https://developer.kenticocloud.com.
0 commit comments