我正在尝试在我的 Gatsby 博客上添加特色图片,但无法使其正常工作。我在这里和那里尝试了几件事情,但我一直收到此错误消息:Field "featuredImage" must not have a selection since type "String" has no subfields.
这是我的博客结构:
src
|- images
|- house.jpeg
| - pages
|- actualites
|- house.mdx
Run Code Online (Sandbox Code Playgroud)
我house.mdx有以下frontmatter:
---
title: House
path: /house
date: 2019-01-29
featuredImage: ../../images/house.jpeg
---
Run Code Online (Sandbox Code Playgroud)
我gatsby-plugin看起来像这样:
plugins: [
`gatsby-plugin-resolve-src`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/pages`,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 800,
},
},
],
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1200,
},
},
],
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
],
Run Code Online (Sandbox Code Playgroud)
我不知道我做错了什么...... http://localhost:8000/___graphql 向我展示了我的featuredImage但不是图像的子字段,所以我想它不明白我的字段是一个图像.
你能帮我指出我所缺少的吗?
谢谢
| 归档时间: |
|
| 查看次数: |
268 次 |
| 最近记录: |