-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(contentful): add support for tags #31746
Conversation
@@ -24,7 +24,7 @@ const restrictedNodeFields = [ | |||
`parent`, | |||
] | |||
|
|||
const restrictedContentTypes = [`entity`, `reference`] | |||
const restrictedContentTypes = [`entity`, `reference`, `tag`, `asset`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is potentially breaking. Users having a tag
contentType will no more be able to build their site. They might to be able to rewrite their queries and enable the useNameForId
option.
Asset is probably problematic since forever.
All restrictions can be lifted with the rewrites in #31286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how many people use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asset probably nobody, as it am very certain it would break the build already.
Having a content type called tag
might be used in very complex spaces. Still, it is much more likely its a field called tag(s)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put this behind a flag then?
Contentful just updated the JS-SDK to cover the missing endpoint. Will refactor this PR asap. https://github.com/contentful/contentful.js/releases/tag/v8.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had a chance to test this locally but code looks good.
Note: The code is updated, the SDK supports the metatag collection endpoint since the last update :) |
Hey @axe312ger, |
IMHO the code is ready. The e2e example demonstrates the usage and proofs that it works. I restart the CI to get all ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've added some questions and nits
// Link tags | ||
if (entryItem?.metadata?.tags) { | ||
entryNode.metadata = { | ||
tags___NODE: entryItem?.metadata?.tags.map(tag => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tags___NODE: entryItem?.metadata?.tags.map(tag => | |
tags___NODE: entryItem.metadata?.tags.map(tag => |
@@ -24,7 +24,7 @@ const restrictedNodeFields = [ | |||
`parent`, | |||
] | |||
|
|||
const restrictedContentTypes = [`entity`, `reference`] | |||
const restrictedContentTypes = [`entity`, `reference`, `tag`, `asset`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put this behind a flag then?
createTypes( | ||
schema.buildObjectType({ | ||
name: `ContentfulTag`, | ||
fields: { | ||
name: { type: `String!` }, | ||
contentful_id: { type: `String!` }, | ||
id: { type: `ID!` }, | ||
}, | ||
interfaces: [`Node`], | ||
}) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this out of sourceNodes into schemaCustimization API.
A contentfulTag does not have sys fields? (please add a don't infer to it as well)
b3beb26
to
fb5a206
Compare
fb5a206
to
14857d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
Implements the new
metatags.tags
property. See https://www.contentful.com/blog/2021/04/08/governance-tagging-metadata/ContentfulTag
Potentially breaking: