javascript - 有没有办法在 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
解决方案
Wordsby 现在默认情况下实际上是这样做的。https://github.com/TylerBarnes/wordsby
他还专门为此问题创建了一个名为 gatsby-wordpress-inline-images 的插件。
https://github.com/TylerBarnes/gatsby-wordpress-inline-images
推荐阅读
- node.js - 部署到 AWS 时出现 jsonwebtoken 问题
- android - Android Multiline autocompletetextview 下拉滚动出现一项错误
- java - 用户输入任何其他数据类型后,我需要输入正确的输入
- java - 调用 nextLine() 的扫描仪发出 NoSuchLineException
- html - 更漂亮的是打破胡子模板
- python - 使用 pytorch 对数据集进行过采样
- sql - 如何仅从每个部门中选择一个记录或第一个测试名称?
- c# - 如何找出目录中存在的文件c#
- delphi - Delphi 10.3.2 (FMX) 是否支持 Android Talkback 屏幕阅读器?
- java - 使用 Spring(Hibernate)在 Oracle DB 连接(保存方法)时出错