我正在将使用启动器构建的Gatsby网站(v1)从基于文件的Markdown格式的博客文章转换为使用gatsby-source-mongodb插件。来自数据库的降价与文件中的字节相同。我映射了MD数据,将 post 属性转换为Markdown。它可以很好地获取frontmatter标题属性:
map: { blogposts: { post: `text/markdown` } },
在渲染组件(由模板生成)中,各个查询如下所示:
文件版本
query BlogPostByPath($path: String!) {
# Path is to blog post markdown file
markdownRemark(frontmatter: { path: { eq: $path } }) {
id
html
frontmatter {
title
}
}
}
数据库版本
query BlogPostByPath($id: String!) {
mongodbLocalBlogposts(id: { eq: $id }) {
id
post {
childMarkdownRemark {
html
frontmatter {
title
}
}
}
}
}
降价
---
title: Barn
---
It isn't known precisely when the barn was constructed, but it appears to be a bit newer than the main house. It still retains almost all of its original features, including an elaborate metal ventilator on top, which has faux shingles on its base.
The interior features a number of pens and gates between them, and a hay mow with sliding doors that allow hay to be thrown into a manger below. It has two grain bins, and a milking stanchion.
![Barn Ventilator](./IMAGES/barnVentilator.jpg)
<center>
The top of the barn is adorned with a fancy ventilator
</center>
在基于文件的版本中,图像呈现为响应链接。在数据库版本中,它呈现为(巨大的原始)IMG标签:
我不确定该如何调试;这似乎是查询问题或markdown转换错误。我该如何进行调试?