contentful

How to fetch a single entry from Contentful and query by field value?

孤人 提交于 2021-02-19 16:07:36
问题 I am trying to retrieve a single entry based on the name custom field of my entry. I have tried using the JS SDK with various options: client.getEntry("entryID") // .where("content_type", "Restaurant") // .where("fields.name[match]", "RestaurantName") // .all() .then(data => console.log('data', data)) .catch(err => console.log('err', err)) But based on the errors back, it's suggesting I can only use .getEntry and pass in the entry ID. I also looked at making an HTTP request with axios but

How to fetch a single entry from Contentful and query by field value?

一个人想着一个人 提交于 2021-02-19 16:04:58
问题 I am trying to retrieve a single entry based on the name custom field of my entry. I have tried using the JS SDK with various options: client.getEntry("entryID") // .where("content_type", "Restaurant") // .where("fields.name[match]", "RestaurantName") // .all() .then(data => console.log('data', data)) .catch(err => console.log('err', err)) But based on the errors back, it's suggesting I can only use .getEntry and pass in the entry ID. I also looked at making an HTTP request with axios but

How to fetch a single entry from Contentful and query by field value?

£可爱£侵袭症+ 提交于 2021-02-19 16:01:13
问题 I am trying to retrieve a single entry based on the name custom field of my entry. I have tried using the JS SDK with various options: client.getEntry("entryID") // .where("content_type", "Restaurant") // .where("fields.name[match]", "RestaurantName") // .all() .then(data => console.log('data', data)) .catch(err => console.log('err', err)) But based on the errors back, it's suggesting I can only use .getEntry and pass in the entry ID. I also looked at making an HTTP request with axios but

How to retrieve linked fields in Contentful query

旧城冷巷雨未停 提交于 2021-02-19 07:31:10
问题 I'm using Contentful and have a content model which uses a series of related fields. I am querying my content in NodeJS using the JS api. If I call get entries, like so contentfulClient.getEntries({ content_type: 'homePage' }) it fetches all the content of type homePage, and includes the actual field data for each related field, like so "subField": { "sys": { "space": { "sys": { "type": "Link", "linkType": "Space", "id": "#######" } }, "id": "#######", "type": "Entry", "createdAt": "2017-03

Fetch content from rich text field

送分小仙女□ 提交于 2021-01-28 21:12:43
问题 I am following this documentation to render rich text from Contentful. So far I have installed gatsby-source-contentful , now I am querying the rich text content with a graphQL query, before adding to my template. Issue: I cannot query the references field. From my understanding there was a recent breaking change that required the raw subfield to be queried...but unfortunately I can't query any subfield within raw . I am not sure what the issue can possibly be. Query { allContentfulArticle {

How to use GraphQL fragment on multiple types

送分小仙女□ 提交于 2020-06-13 19:24:27
问题 I have a Gatsby project with very similar GraphQL queries for two different types of content: regular pages and wiki articles. Page by slug export const query = graphql` query($slug: String!) { page: contentfulPage(slug: {eq: $slug}) { title slug body { remark: childMarkdownRemark { excerpt html headings { value depth } } } updatedAt(formatString: "D. MMM YYYY") authors { name email } } } ` Wiki article by slug export const query = graphql` query($slug: String!) { article:

Accessing your Contentful space failed with gatsby-source-contentful

我的未来我决定 提交于 2020-05-29 06:49:48
问题 gatsby: 2.20.8 gatsbh-source-contentful: 2.2.5 I've verified my spaceId and accessToken are correct, and I've verified that these keys have access to my Contentful development environment. I've tried: Enabling GATSBY_CONTENTFUL_OFFLINE Deleting the .cache directory Deleting node_modules Setting environment to "master" and removing it completely Wrapping the env vars in template literals (suggested on an old github issue) I keep getting this error. Any ideas? ERROR Accessing your Contentful