【问题标题】:Gatsby Plugin Sitemap does not generate sitemap for my websiteGatsby 插件站点地图不会为我的网站生成站点地图
【发布时间】:2020-05-22 17:32:27
【问题描述】:

以下代码不会生成我的 Gatsby 网站的站点地图。我使用 wordpress 作为我的 CMS。有什么建议我做错了吗?

`gatsby-plugin-sitemap`,
    {
      resolve: `gatsby-plugin-sitemap`,
      options: {
        output: `./expatsitemap.xml/`,
        exclude: [`/category/*`],
        query: `
          {
            site {
              siteMetadata {
                siteUrl
              }
            }

            allSitePage {
              edges {
                node {
                  path
                }
              }
            }
        }`,
        serialize: ({ site, allSitePage }) =>
          allSitePage.edges.map(edge => {
            return {
              url: site.siteMetadata.siteUrl + edge.node.path,
              changefreq: `daily`,
              priority: 0.7,
            }
          })
      }
    }

【问题讨论】:

    标签: gatsby sitemap wordpress-rest-api


    【解决方案1】:

    您需要在options 中将您的主域添加为host: "https://www.yourwebsite.com",

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-29
      • 2015-08-11
      • 1970-01-01
      • 2018-02-22
      • 2014-09-24
      • 2021-06-19
      • 2021-04-24
      相关资源
      最近更新 更多