大网数据广告活动
网站运营与故障问答

For a single page app, What is the proper way to offer large sitemap.xml files to webcrawlers?

· 52CE 我爱测

I am building a single page app (SPA) with Angular . The data to be displayed inside the app is fetched from the backend using REST calls. It concerns a social media website which means it will have a lot of user generated pages.…

问题原文

原帖链接 · Maurice · CC BY-SA 4.0

I am building a single page app (SPA) with Angular. The data to be displayed inside the app is fetched from the backend using REST calls. It concerns a social media website which means it will have a lot of user generated pages.

This also means that the sitemaps can become very large making it unfeasible to package them in the angular app itself. Also the content of the sitemaps can become out of date rapidly because users will be constantly adding, updating or removing their user generated content.

Right now i'm storing my sitemaps in an amazon s3 bucket but people who answered this question say google ignores cross-domain sitemaps.

So how should i offer large sitemaps for an SPA? I have an EC2 instance in the backend that receives the REST calls. This instance also autogenerates the sitemaps periodically and puts them in a folder called static/sitemaps that is also exposed to the internet. Could i use my EC2 instance to offer the sitemaps or would that be the same thing as using a s3 bucket. I'd prefer not to offer the sitemaps from EC2 because storage on EC2 is more expensive then it is on s3.

The last thing i could do is create a subdomain for the sitemaps. For instance sitemaps.example.com next to the example.com domain. Perhaps i could redirect crawlers visiting sitemaps.example.com to the sitemaps index file that is stored in my s3 bucket. But i'm not sure whether that works either.

So the question is; For a single page app, What is the proper way to offer large sitemap.xml files to webcrawlers?

Thank you

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

One solution would be to use CloudFront to tie various services together under a single domain. CloudFront is Amazon's content delivery network (CDN.) You point your DNS to CloudFront and it fetches content from various origin servers based on behavior routing rules. It can also cache content on edge nodes if desired to speed up performance.

You could leave your sitemaps in the S3 bucket and your site hosted in its current place (like an EC2 instance or load balancer.) You would configure two "origins" in CloudFront, one for the bucket and one for the main site. You would configure behavior to serve https://example.com/ from the main site origin but https://example.com/sitemaps from the bucket.

See Use a CloudFront web distribution to serve content from multiple origins

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2022-01-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。