NUXT 2-动态创建一个带有NUXT AXIOS数据的站点地图
有这样的终点。当我发送请求时,响应如下
我正在使用Axios。 当您在标题中给FR时,fr站点地形会来
http://mysite/api/sitemap
(
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://mysite/tr</loc>
<priority>1.0</priority>
</url>
<url>
<loc>https://mysite/tr/faq/my-faq-1</loc>
<priority>0.6</priority>
</url>
<url>
<loc>https://mysite/tr/blog/my-blog-1</loc>
<priority>0.6</priority>
</url>
</urlset>
。
如何将传入数据作为站点文件写入?
There is such an endpoint. When I send a request, the response is as follows
I am using axios. (When you give FR in the header, FR sitemaps come. When I give EN, EN sitemaps come.)
http://mysite/api/sitemap
This is the response I got
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://mysite/tr</loc>
<priority>1.0</priority>
</url>
<url>
<loc>https://mysite/tr/faq/my-faq-1</loc>
<priority>0.6</priority>
</url>
<url>
<loc>https://mysite/tr/blog/my-blog-1</loc>
<priority>0.6</priority>
</url>
</urlset>
sitemap.xml ---- sitemap-en.xml ---- sitemap-fr.xml
How can I write the incoming data as a sitemap file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用“@nuxtjs/stitemap”软件包。 ( https://sitemap.nuxtjs.org )
You must use "@nuxtjs/sitemap" package. (https://sitemap.nuxtjs.org)