nuxt-sitemap 找不到预渲染页面

问题描述 投票:0回答:1

我尝试构建的站点地图找不到动态呈现的博客页面。

我在做什么:

yarn build // running nuxi build
node .output/server/index.mjs

我的设置:

nuxt:^3.10.2,@nuxtjs/sitemap:^5.1.0

显示博客文章,通过我的组件之一中的 apollo 进行获取:

const { data, pending } = await useAsyncQuery(getPosts, { size: numArticlesPerPage, offset: offset.value })

另外,根据我添加到 nuxt.config.ts 中的文档:

nitro: {
    prerender: {
      crawlLinks: true,
      routes: ["/", "/blog"], // I also tried adding the sitemap file here directly
    },
  },

发生了什么:

  • 正在为我的 /pages 目录中的所有页面生成站点地图
  • 预渲染输出显示正在渲染的所有必需的博客页面,例如 /blog/article-x、/blog/article/y。博客页面在服务器上也可见
  • 在站点地图中没有显示这些博客文章
vue.js nuxt.js seo
1个回答
0
投票

您需要为 nuxt sitemap 添加 API 源来生成页面。

© www.soinside.com 2019 - 2024. All rights reserved.