Skip to content

Commit

Permalink
feat: tags are now enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Jul 27, 2021
1 parent 0255a5b commit 3a03727
Show file tree
Hide file tree
Showing 15 changed files with 466 additions and 116 deletions.
14 changes: 7 additions & 7 deletions e2e-tests/contentful/src/pages/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,33 @@ export default TagsPage

export const pageQuery = graphql`
query TagsQuery {
tags: allContentfulTag(sort: { fields: contentful_id }) {
tags: allContentfulTag(sort: { fields: id }) {
nodes {
name
contentful_id
}
}
integers: allContentfulNumber(
sort: { fields: contentful_id }
integers: allContentfulContentTypeNumber(
sort: { fields: sys___id }
filter: {
metadata: {
tags: { elemMatch: { contentful_id: { eq: "numberInteger" } } }
}
node_locale: { eq: "en-US" }
sys: { locale: { eq: "en-US" } }
}
) {
nodes {
title
integer
}
}
decimals: allContentfulNumber(
sort: { fields: contentful_id }
decimals: allContentfulContentTypeNumber(
sort: { fields: sys___id }
filter: {
metadata: {
tags: { elemMatch: { contentful_id: { eq: "numberDecimal" } } }
}
node_locale: { eq: "en-US" }
sys: { locale: { eq: "en-US" } }
}
) {
nodes {
Expand Down
8 changes: 0 additions & 8 deletions packages/gatsby-source-contentful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ Additional config which will get passed to [Contentfuls JS SDK](https://github.c

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

**`enableTags`** [boolean][optional] [default: `false`]

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.

Learn how to use them at the [Contentful Tags](#contentful-tags) section.

## How to query for nodes

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

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

You need to set the `enableTags` flag to `true` to use this new feature.

### List available tags

This example lists all available tags. The sorting is optional.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ exports.initialSync = () => {
},
},
},
metadata: { tags: [] },
},
{
sys: {
Expand Down Expand Up @@ -600,6 +601,7 @@ exports.initialSync = () => {
},
},
},
metadata: { tags: [] },
},
],
assets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ exports.initialSync = () => {
publishDate: { "en-US": `2017-05-12T00:00+02:00` },
tags: { "en-US": [`javascript`] },
},
metadata: { tags: [] },
},
{
sys: {
Expand Down Expand Up @@ -131,6 +132,7 @@ exports.initialSync = () => {
publishDate: { "en-US": `2017-05-15T00:00+02:00` },
tags: { "en-US": [`general`] },
},
metadata: { tags: [] },
},
{
sys: {
Expand Down Expand Up @@ -196,6 +198,7 @@ exports.initialSync = () => {
publishDate: { "en-US": `2017-05-16T00:00+02:00` },
tags: { "en-US": [`javascript`, `static-sites`] },
},
metadata: { tags: [] },
},
{
sys: {
Expand Down Expand Up @@ -252,6 +255,7 @@ exports.initialSync = () => {
},
},
},
metadata: { tags: [] },
},
],
assets: [
Expand Down Expand Up @@ -765,6 +769,7 @@ exports.createBlogPost = () => {
},
publishDate: { "en-US": `2020-04-01T00:00+02:00` },
},
metadata: { tags: [] },
},
],
assets: [
Expand Down Expand Up @@ -1155,6 +1160,7 @@ exports.updateBlogPost = () => {
},
publishDate: { "en-US": `2020-05-15T00:00+02:00` },
},
metadata: { tags: [] },
},
],
assets: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypeBlogPost",
},
"metadata": Object {
"tags___NODE": Array [],
},
"parent": "Blog Post",
"publishDate": "2020-04-01T00:00+02:00",
"slug": "integration-tests",
Expand Down Expand Up @@ -51,6 +54,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down Expand Up @@ -84,6 +90,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypeBlogPost",
},
"metadata": Object {
"tags___NODE": Array [],
},
"parent": "Blog Post",
"publishDate": "2020-04-01T00:00+02:00",
"slug": "integration-tests",
Expand Down Expand Up @@ -122,6 +131,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down Expand Up @@ -161,6 +173,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down Expand Up @@ -200,6 +215,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down Expand Up @@ -233,6 +251,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypeBlogPost",
},
"metadata": Object {
"tags___NODE": Array [],
},
"parent": "Blog Post",
"publishDate": "2020-05-15T00:00+02:00",
"slug": "hello-world-1234",
Expand Down Expand Up @@ -271,6 +292,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down Expand Up @@ -304,6 +328,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypeBlogPost",
},
"metadata": Object {
"tags___NODE": Array [],
},
"parent": "Blog Post",
"publishDate": "2020-05-15T00:00+02:00",
"slug": "hello-world-1234",
Expand Down Expand Up @@ -342,6 +369,9 @@ Object {
"owner": "gatsby-source-contentful",
"type": "ContentfulContentTypePerson",
},
"metadata": Object {
"tags___NODE": Array [],
},
"name": "John Doe",
"parent": "Person",
"phone": "0176 / 1234567",
Expand Down
Loading

0 comments on commit 3a03727

Please sign in to comment.