I have a Gatsby-Contentful site I am currently developing, and I have two posts on Contentful which contain Embedded Assets in the Rich Text fields of each post.
In one Rich Text field, this embedded asset appears as follows:
{
"data": {
"target": {
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "aw0p4zkj7lhv"
}
},
"id": "c5N0u9h6AksECP8JZEzOe1D",
"type": "Asset",
"createdAt": "2019-07-29T11:48:08.826Z",
"updatedAt": "2019-07-29T11:48:08.826Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 1
},
"fields": {
"title": {
"en-US": "dummy"
},
"description": {
"en-US": "dummy so api works"
},
"file": {
"en-US": {
"url": "//images.ctfassets.net/aw0p4zkj7lhv/5N0u9h6AksECP8JZEzOe1D/af219e63f6e381c7124a6d65a0fe85e0/test.jpg",
"details": {
"size": 58342,
"image": {
"width": 1000,
"height": 666
}
},
"fileName": "test.jpg",
"contentType": "image/jpeg"
}
}
}
}
},
"content": [],
"nodeType": "embedded-asset-block"
}
}
while in another post's Rich Text field it is missing a lot of the data:
{
"data": {
"target": {
"sys": {
"id": "c5N0u9h6AksECP8JZEzOe1D",
"type": "Link",
"linkType": "Asset"
}
}
},
"content": [],
"nodeType": "embedded-asset-block"
}
}
Why is there such a discrepancy, when I have embedded the images in both Rich Text fields in exactly the same way?
当我遇到这种情况时,我通常必须删除缓存 (root/.cache) 和公共 (root/public) 文件夹并重新启动服务器以从 Contentful 获取正确的数据。
This happens because your cached files not correctly updated during the rebuild.
Just install Gatsby CLI with npm install -g gatsby-cli
Then gatsby clean
Then gatsby develop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.