将 NUXT 与 SEO 兼容性用于数千种产品 [英] Using NUXT with SEO compatibility for thousands of products

查看:53
本文介绍了将 NUXT 与 SEO 兼容性用于数千种产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我构建应用程序时,它只会为数据库中已有的产品创建路由.当我添加新产品时,这些链接不会自动添加到路由中,并且与 SEO 不兼容.我必须重建应用程序才能接收"新产品.有没有更好的方法来做到这一点?

When I build the app, it only creates routes for products already in the database. When I add new products those links aren't automatically added to the routes, and aren't SEO compatible. I have to rebuild the app to "pick up" the new products. Is there a better way of doing this?

推荐答案

这里真的只有 3 个选项.

There's really only 3 options here.

选项 1:重新构建应用

这是你已经在做的事情,所以我不会更多地涉及它,除了指出这仅适用于静态代.

This is what you're already doing, so I won't touch base on it more, other than point out this only works for static generations.

然而,SEO 爬虫已经到了可以等待 JS 加载的地步,所以这有时 对 SEO 友好.如果您同意,那么您可以在 SPA 模式下运行并获取产品客户端.

However, SEO crawlers are getting to the point where they can wait for JS to load, so this can be SEO friendly sometimes. If you're okay with that, then you can just run in SPA mode and fetch the products client side.

选项 2:服务器端渲染

在通用模式下使用 Nuxt 时,您可以使用 fetch异步数据 API.产品可以添加到数据库或 CMS,并立即可供应用使用.

When using Nuxt in universal mode, you can fetch and render the product data server side, either using the fetch or async data API's. Products can be added to a database or CMS, and immediately be usable by the app.

以这种方式呈现的内容对 SEO 友好,因为 HTML 在服务器端呈现,前提是您还记得使用正确的标题/描述更新元值.

Content rendered this way is SEO friendly as the HTML is rendered server side, provided you also remember to update the meta values with the correct titles/descriptions.

我认为这是处理大量可索引内容的最佳选择,但不幸的是需要运行服务器来托管应用程序.

I'd say this is the best option for large amounts of indexable content, but unfortunately requires a server to be run to host the app.

选项 3:预渲染

您可以使用第 3 方服务,例如 在此处输入链接描述,它将处理预运行您的应用程序搜索引擎优化服务.但是,它不是免费的,所以我认为这最终是最糟糕的.

You can use a 3rd party service, like enter link description here, which will handle pre-running your app for SEO services. However, it's not free, and so I'd say this is ultimately the worst.

这篇关于将 NUXT 与 SEO 兼容性用于数千种产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆