首页 > 解决方案 > 有没有办法在 Gatsby 中正确显示帖子内容中的图像?

问题描述

实际上,我正在使用来自 WordPress 的数据在 Gatsby 中构建我的第一个博客。

我坚持一个问题:如何正确显示从 WYSIWYG 到 Gatsby 的图像?

例如,在此页面上,两个图像中的一个正确显示,但第二个却没有。有人可以解释我是否可以在 /static/ 文件夹中下载 allWpMedia (如默认图像)并将 all 替换<img /><Img />from gatsby-image

谢谢

我的包装版本

Node@10.13.0
NPM@6.4.1
├── gatsby@2.13.32
├── gatsby-image@2.2.6
├── gatsby-plugin-manifest@2.2.3
├── gatsby-plugin-offline@2.2 .4
├── gatsby-plugin-prefetch-google-fonts@1.4.2
├── gatsby-plugin-react-helmet@3.1.2
├── gatsby-plugin-sass@2.1.3
├── gatsby-plugin -sharp@2.2.8
├── gatsby-plugin-sitemap@2.2.3
├── gatsby-remark-images@3.1.7
├── gatsby-source-filesystem@2.1.5
├── gatsby-source-wordpress @3.1.10
├── gatsby-transformer-remark@2.6.8
├── gatsby-transformer-sharp@2.2.4
├── gatsby-wordpress-inline-images@1.0.0
├── html-react-parser @0.9.1
├── jsdom@15.1.1
├── node-sass@4.12.0
├──
prettier@1.18.2 ├──
prop-types@15.7.2 ├── react@16.8.6
├── react-body-classname@1.3.0
├── react-dom@16.8.6
└─ ─ react-helmet@5.2.1

标签: javascriptreactjsgatsby

解决方案


Wordsby 现在默认情况下实际上是这样做的。https://github.com/TylerBarnes/wordsby

他还专门为此问题创建了一个名为 gatsby-wordpress-inline-images 的插件。

https://github.com/TylerBarnes/gatsby-wordpress-inline-images


推荐阅读