我想为我的 Gatby.js 博客上的每个帖子显示特定的缩略图。我正在为此使用 gatsby-image。但我收到此错误:37:11 错误无法在“MarkdownRemarkFrontmatter”类型上查询字段“timage”。您指的是 “title” 吗? graphql/模板字符串✖ 4个问题(1个错误,3个警告)GraphQL 错误遇到 1 个错误: - 类型“MarkdownRemarkFrontmatter”上的未知字段“timage”。文件:C:/Users/mikol/piec/src/pages/index.js这是我的代码:索引.js:import React from "react"import { Link, graphql, StaticQuery } from "gatsby"import Image from "../components/image"import SEO from "../components/seo"import Post from "../components/Post"const IndexPage = () => ( <> <StaticQuery query={indexQuery} render={data => { return ( <div> {data.allMarkdownRemark.edges.map(({ node }) => ( <Post title={node.frontmatter.title} path={node.frontmatter.path} body={node.excerpt} fluid={node.frontmatter.timage.childImageSharp.fluid} /> ))} </div> ) }}/> </>)const indexQuery = graphql`query{ allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }){ edges{ node{ id frontmatter{ title path date timage{ childImageSharp{ fluid{ ...GatbyImageSharpFluid } } } } excerpt } } }}`;export default IndexPagegatsby-config.js:module.exports = { siteMetadata: { title: `Gatsby Default Starter`, description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`, author: `@gatsbyjs`, }, plugins: [ `gatsby-plugin-react-helmet`, { resolve: `gatsby-source-filesystem`, options: { name: `images`, path: `${__dirname}/src/images`, },感谢您的帮助!
添加回答
举报
0/150
提交
取消