我正在关注Andrew Mead在Gatsby Bootcamp上的youtube教程,直到3:10:00分钟,一切都很顺利,但一旦我安装了gatsby-remark-relative-images和gatsby-remark-images插件,并将它们添加到gatsby-config.js文件中以显示图像,当我运行npm run develop时,我得到一个错误,如下图所示。
下面是我的gatsby-config.js文件。
/**
* Configure your Gatsby site with this file.
*
* See: https://www.gatsby
我试图在我的盖茨比博客上添加一个特色图片,但无法使它工作。我到处找了几样东西,但是我一直有一条错误消息:Field "featuredImage" must not have a selection since type "String" has no subfields.
以下是我的博客结构:
src
|- images
|- house.jpeg
| - pages
|- actualites
|- house.mdx
我的house.mdx有以下前端内容:
---
title: House
path: /house
date: 2
我试着把我的WP帖子的特色图片张贴到网站上。我遵循了教程,现在我能够在网站上看到有特色的图片,但我也收到了这样的警告:
index.js:2177 Warning: Failed prop type: Invalid prop `fixed` supplied to `Image`.
in Image (at BlogPost.js:17)
in BlogPostTemplate (created by HotExportedBlogPostTemplate)
in AppContainer (created by HotExportedBlogPostTemplate
我正在尝试使用GatsbyJS创建一个博客。我遵循以下教程 https://www.gatsbyjs.org/docs/recipes/#optimizing-and-querying-images-in-post-frontmatter-with-gatsby-image 博客包含标题、特色图片和文本。 MDX-file结构如下所示。 ---
title: My First Post
featuredImage: ./corgi.png
---
Post content... 而且,gatsby-node.js文件中的代码如下 exports.createPages = async ({
我有一个照片/Wordpress网站,在那里我的每个帖子都包含一张特色图片。我正在尝试创建的是在发布帖子后自动将上传的特色图像发布到Twitter。我设法向Functions.php添加了一个在发布帖子时执行的函数。
add_action('publish_post','postToTwitter');
postToTwitter函数使用Matt Harris OAuth 1.0A库创建一条tweet。如果我附加了一个与postToTwitter函数的文件相关的图像,则可以很好地工作。
// this is the jpeg file to upload. It
因此,我试图找出如何渲染我的图片,是内联我的博客文章。我确实有一个功能突出的图片顶部工作,但不知道如何获得内联图像。
图像存储在src/images/中
office-upgrade.md
---
title: "Office Upgrade"
image: ../images/office1.jpg
featured: false
author:
name: "jrock2004"
date: "2017-08-06"
tags:
- general
---
So, when I moved into our new house 3
我正在以编程的方式将图片上传到我的Wordpress媒体集,并将它们设置为我的帖子的特色图片,效果非常好。
我想生成这些特色图像的缩略图,就像Wordpress在通过插入媒体窗格添加图像时创建调整大小的缩略图一样,它会在其中创建多个文件,每个文件都具有在文件名中指定的新尺寸。
不幸的是,我很难找到任何解释如何正确做到这一点的东西。
以下是相关代码。它成功地创建了帖子,并将特色图像设置为媒体文件,但不会生成缩略图。
任何帮助都将不胜感激!
// If the post was created
if($post_id) {
// Add meta/custom field data
我在Netlify CMS中使用Gatsby,在Netlify CMS中预览模板时遇到了问题。
有一个可以像预期的那样工作。它从markdown和frontmatter获取数据,并与Netlify CMS小部件链接,还有一个通过useStaticQuery钩子获取数据的组件。
但是,一旦我在Netlify管理中访问,我就会得到:
Error: The result of this StaticQuery could not be fetched.
This is likely a bug in Gatsby and if refreshing the page does not fix it