Gatsby Wordpress 源插件中的内联图像
Inline Images in Gatsby Wordpress source plugin
我正在按照所有说明使用此插件https://www.gatsbyjs.com/plugins/@draftbox-co/gatsby-wordpress-inline-images/,但它不起作用。
有人知道哪里出了问题吗?
盖茨比-config.js:
{
resolve: 'gatsby-source-wordpress',
options: {
excludedRoutes: [
'/wp/v2/users/**',
'/wp/v2/settings*',
'/wp/v2/themes*'
],
baseUrl: 'domain',
protocol: 'http',
postTypes: ["post", "page"],
plugins: [
{
resolve: `@draftbox-co/gatsby-wordpress-inline-images`,
options: {
baseUrl: `domain`,
protocol: `http`
}
}
],
hostingWPCOM: false,
useACF: true,
searchAndReplaceContentUrls: {
sourceUrl: 'http://domain',
replacementUrl: ''
}
}
},
Gatsby 在更新图像和 href 时有时会出现错误。
尝试清除缓存。
gatsby clean
之前
gatsby develop
我可以通过 http 和 https 访问 wordpress 站点。我只是将协议 url(gatsby 插件配置)更改为 https 并工作
resolve: 'gatsby-source-wordpress',
options: {
excludedRoutes: [
'/wp/v2/users/**',
'/wp/v2/settings*',
'/wp/v2/themes*'
],
baseUrl: 'domain.net',
protocol: 'https',
postTypes: ["post", "page"],
plugins: [
{
resolve: '@draftbox-co/gatsby-wordpress-inline-images',
options: {
baseUrl: 'domain.net',
protocol: 'https',
withWebp: true,
}
}
],
hostingWPCOM: false,
useACF: true,
searchAndReplaceContentUrls: {
sourceUrl: 'https://domain',
replacementUrl: ''
}
}
您看不到内嵌图像的原因是您的配置:
searchAndReplaceContentUrls: {
sourceUrl: 'http://domain',
replacementUrl: ''
}
如果删除它,您将看到带有正确 Wordpress 源代码的内联图像 url。缺点是您的链接(如果您使用 gatsby-link
)不会被预取,因为它们将在 url.
中包含 Wordpress sourceUrl
我正在按照所有说明使用此插件https://www.gatsbyjs.com/plugins/@draftbox-co/gatsby-wordpress-inline-images/,但它不起作用。
有人知道哪里出了问题吗?
盖茨比-config.js:
{
resolve: 'gatsby-source-wordpress',
options: {
excludedRoutes: [
'/wp/v2/users/**',
'/wp/v2/settings*',
'/wp/v2/themes*'
],
baseUrl: 'domain',
protocol: 'http',
postTypes: ["post", "page"],
plugins: [
{
resolve: `@draftbox-co/gatsby-wordpress-inline-images`,
options: {
baseUrl: `domain`,
protocol: `http`
}
}
],
hostingWPCOM: false,
useACF: true,
searchAndReplaceContentUrls: {
sourceUrl: 'http://domain',
replacementUrl: ''
}
}
},
Gatsby 在更新图像和 href 时有时会出现错误。
尝试清除缓存。
gatsby clean
之前
gatsby develop
我可以通过 http 和 https 访问 wordpress 站点。我只是将协议 url(gatsby 插件配置)更改为 https 并工作
resolve: 'gatsby-source-wordpress',
options: {
excludedRoutes: [
'/wp/v2/users/**',
'/wp/v2/settings*',
'/wp/v2/themes*'
],
baseUrl: 'domain.net',
protocol: 'https',
postTypes: ["post", "page"],
plugins: [
{
resolve: '@draftbox-co/gatsby-wordpress-inline-images',
options: {
baseUrl: 'domain.net',
protocol: 'https',
withWebp: true,
}
}
],
hostingWPCOM: false,
useACF: true,
searchAndReplaceContentUrls: {
sourceUrl: 'https://domain',
replacementUrl: ''
}
}
您看不到内嵌图像的原因是您的配置:
searchAndReplaceContentUrls: {
sourceUrl: 'http://domain',
replacementUrl: ''
}
如果删除它,您将看到带有正确 Wordpress 源代码的内联图像 url。缺点是您的链接(如果您使用 gatsby-link
)不会被预取,因为它们将在 url.