Skip to content

Commit 3a03727

Browse files
committed
feat: tags are now enabled by default
1 parent 0255a5b commit 3a03727

File tree

15 files changed

+466
-116
lines changed

15 files changed

+466
-116
lines changed

e2e-tests/contentful/src/pages/tags.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,33 @@ export default TagsPage
5656

5757
export const pageQuery = graphql`
5858
query TagsQuery {
59-
tags: allContentfulTag(sort: { fields: contentful_id }) {
59+
tags: allContentfulTag(sort: { fields: id }) {
6060
nodes {
6161
name
6262
contentful_id
6363
}
6464
}
65-
integers: allContentfulNumber(
66-
sort: { fields: contentful_id }
65+
integers: allContentfulContentTypeNumber(
66+
sort: { fields: sys___id }
6767
filter: {
6868
metadata: {
6969
tags: { elemMatch: { contentful_id: { eq: "numberInteger" } } }
7070
}
71-
node_locale: { eq: "en-US" }
71+
sys: { locale: { eq: "en-US" } }
7272
}
7373
) {
7474
nodes {
7575
title
7676
integer
7777
}
7878
}
79-
decimals: allContentfulNumber(
80-
sort: { fields: contentful_id }
79+
decimals: allContentfulContentTypeNumber(
80+
sort: { fields: sys___id }
8181
filter: {
8282
metadata: {
8383
tags: { elemMatch: { contentful_id: { eq: "numberDecimal" } } }
8484
}
85-
node_locale: { eq: "en-US" }
85+
sys: { locale: { eq: "en-US" } }
8686
}
8787
) {
8888
nodes {

packages/gatsby-source-contentful/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ Additional config which will get passed to [Contentfuls JS SDK](https://github.c
167167

168168
Use this with caution, you might override values this plugin does set for you to connect to Contentful.
169169

170-
**`enableTags`** [boolean][optional] [default: `false`]
171-
172-
Enable the new [tags feature](https://www.contentful.com/blog/2021/04/08/governance-tagging-metadata/). This will disallow the content type name `tags` till the next major version of this plugin.
173-
174-
Learn how to use them at the [Contentful Tags](#contentful-tags) section.
175-
176170
## How to query for nodes
177171

178172
Two standard node types are available from Contentful: `Asset` and `ContentType`.
@@ -380,8 +374,6 @@ module.exports = {
380374

381375
## [Contentful Tags](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-tags)
382376

383-
You need to set the `enableTags` flag to `true` to use this new feature.
384-
385377
### List available tags
386378

387379
This example lists all available tags. The sorting is optional.

packages/gatsby-source-contentful/src/__fixtures__/rich-text-data.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ exports.initialSync = () => {
438438
},
439439
},
440440
},
441+
metadata: { tags: [] },
441442
},
442443
{
443444
sys: {
@@ -600,6 +601,7 @@ exports.initialSync = () => {
600601
},
601602
},
602603
},
604+
metadata: { tags: [] },
603605
},
604606
],
605607
assets: [

packages/gatsby-source-contentful/src/__fixtures__/starter-blog-data.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ exports.initialSync = () => {
6666
publishDate: { "en-US": `2017-05-12T00:00+02:00` },
6767
tags: { "en-US": [`javascript`] },
6868
},
69+
metadata: { tags: [] },
6970
},
7071
{
7172
sys: {
@@ -131,6 +132,7 @@ exports.initialSync = () => {
131132
publishDate: { "en-US": `2017-05-15T00:00+02:00` },
132133
tags: { "en-US": [`general`] },
133134
},
135+
metadata: { tags: [] },
134136
},
135137
{
136138
sys: {
@@ -196,6 +198,7 @@ exports.initialSync = () => {
196198
publishDate: { "en-US": `2017-05-16T00:00+02:00` },
197199
tags: { "en-US": [`javascript`, `static-sites`] },
198200
},
201+
metadata: { tags: [] },
199202
},
200203
{
201204
sys: {
@@ -252,6 +255,7 @@ exports.initialSync = () => {
252255
},
253256
},
254257
},
258+
metadata: { tags: [] },
255259
},
256260
],
257261
assets: [
@@ -765,6 +769,7 @@ exports.createBlogPost = () => {
765769
},
766770
publishDate: { "en-US": `2020-04-01T00:00+02:00` },
767771
},
772+
metadata: { tags: [] },
768773
},
769774
],
770775
assets: [
@@ -1155,6 +1160,7 @@ exports.updateBlogPost = () => {
11551160
},
11561161
publishDate: { "en-US": `2020-05-15T00:00+02:00` },
11571162
},
1163+
metadata: { tags: [] },
11581164
},
11591165
],
11601166
assets: [],

packages/gatsby-source-contentful/src/__tests__/__snapshots__/gatsby-node.js.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Object {
1313
"owner": "gatsby-source-contentful",
1414
"type": "ContentfulContentTypeBlogPost",
1515
},
16+
"metadata": Object {
17+
"tags___NODE": Array [],
18+
},
1619
"parent": "Blog Post",
1720
"publishDate": "2020-04-01T00:00+02:00",
1821
"slug": "integration-tests",
@@ -51,6 +54,9 @@ Object {
5154
"owner": "gatsby-source-contentful",
5255
"type": "ContentfulContentTypePerson",
5356
},
57+
"metadata": Object {
58+
"tags___NODE": Array [],
59+
},
5460
"name": "John Doe",
5561
"parent": "Person",
5662
"phone": "0176 / 1234567",
@@ -84,6 +90,9 @@ Object {
8490
"owner": "gatsby-source-contentful",
8591
"type": "ContentfulContentTypeBlogPost",
8692
},
93+
"metadata": Object {
94+
"tags___NODE": Array [],
95+
},
8796
"parent": "Blog Post",
8897
"publishDate": "2020-04-01T00:00+02:00",
8998
"slug": "integration-tests",
@@ -122,6 +131,9 @@ Object {
122131
"owner": "gatsby-source-contentful",
123132
"type": "ContentfulContentTypePerson",
124133
},
134+
"metadata": Object {
135+
"tags___NODE": Array [],
136+
},
125137
"name": "John Doe",
126138
"parent": "Person",
127139
"phone": "0176 / 1234567",
@@ -161,6 +173,9 @@ Object {
161173
"owner": "gatsby-source-contentful",
162174
"type": "ContentfulContentTypePerson",
163175
},
176+
"metadata": Object {
177+
"tags___NODE": Array [],
178+
},
164179
"name": "John Doe",
165180
"parent": "Person",
166181
"phone": "0176 / 1234567",
@@ -200,6 +215,9 @@ Object {
200215
"owner": "gatsby-source-contentful",
201216
"type": "ContentfulContentTypePerson",
202217
},
218+
"metadata": Object {
219+
"tags___NODE": Array [],
220+
},
203221
"name": "John Doe",
204222
"parent": "Person",
205223
"phone": "0176 / 1234567",
@@ -233,6 +251,9 @@ Object {
233251
"owner": "gatsby-source-contentful",
234252
"type": "ContentfulContentTypeBlogPost",
235253
},
254+
"metadata": Object {
255+
"tags___NODE": Array [],
256+
},
236257
"parent": "Blog Post",
237258
"publishDate": "2020-05-15T00:00+02:00",
238259
"slug": "hello-world-1234",
@@ -271,6 +292,9 @@ Object {
271292
"owner": "gatsby-source-contentful",
272293
"type": "ContentfulContentTypePerson",
273294
},
295+
"metadata": Object {
296+
"tags___NODE": Array [],
297+
},
274298
"name": "John Doe",
275299
"parent": "Person",
276300
"phone": "0176 / 1234567",
@@ -304,6 +328,9 @@ Object {
304328
"owner": "gatsby-source-contentful",
305329
"type": "ContentfulContentTypeBlogPost",
306330
},
331+
"metadata": Object {
332+
"tags___NODE": Array [],
333+
},
307334
"parent": "Blog Post",
308335
"publishDate": "2020-05-15T00:00+02:00",
309336
"slug": "hello-world-1234",
@@ -342,6 +369,9 @@ Object {
342369
"owner": "gatsby-source-contentful",
343370
"type": "ContentfulContentTypePerson",
344371
},
372+
"metadata": Object {
373+
"tags___NODE": Array [],
374+
},
345375
"name": "John Doe",
346376
"parent": "Person",
347377
"phone": "0176 / 1234567",

0 commit comments

Comments
 (0)