问题原文
原帖链接 · 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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
