首页 > 解决方案 > Gatsby 插件站点地图不会为我的网站生成站点地图

问题描述

下面的代码不会生成我的 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,
            }
          })
      }
    }

标签: gatsbysitemapwordpress-rest-api

解决方案


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


推荐阅读