如何使用Google App Engine动态生成站点地图
我的网站每天都会发生变化 - 我每天都会运行一个带有新故事的新闻网站。我希望Google尽可能频繁地索引我的网站,并希望/需要自动化站点地图。
我使用Google App Engine(带Node.js)运行我的网站。使用GAE-我没有针对根目录的写入。要发布站点地图 - 生成地图后,我需要重新删除整个站点。这是一个不必要的复杂步骤。
我已经搜索了很远,看不到如何保存我的站点地图。因此 - 我考虑使用一个静态生成的孩子,我将其存储在我写入访问的另一个位置。 Google说,它希望同一目录中的所有链接站点地点。因此,这似乎是一个死胡同。
我可以以仅上传站点地图的方式使用“应用程序部署”?还有其他可能性吗?感谢所有建议。 Google似乎不太可能没有提供某种解决方法。
My website changes every day - I run a news website with new stories every day. I want Google to index my site as often as possible and want/need to autogenerate the sitemap.
I use Google App Engine (with Node.js) to run my site. With GAE - I do not have write-access to the root directory. To post the site map - I need to re-deploy my whole site after generating the map. That is an unnecessarily complex step.
I have searched far and wide and cannot see how to save my sitemap. So - I considered using a static one with a dynamically generated child that I store in another location where I have write access. Google says it wants all linked sitemaps in the same directory. So that appears to be a dead-end.
Can I use "App Deploy" in such a way that only the sitemap is uploaded? Any other possibilities? Appreciate any and all suggestions. It seems unlikely that Google didn't provide some way to solve this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于定期创建新URL(例如新闻,博客网站等)的网站,请不要“存储”您的站点地图。它应按需生成,即您的应用程序应包含代码以生成内容时,加载链接
< your_website>/sitemap.xml
已加载。另外,您应该注意,
gcloud应用程序部署
并不总是部署所有文件。它通常部署 已更改的文件。您可以通过运行部署命令,更改单个文件,然后再次运行部署命令来轻松确认这一点。您会看到日志会说 -将1个文件上传到Google Cloud Storage
,而部署将更快。您可以更改X
文件数量,再次部署,并将更新消息以表明它仅部署X
文件。但是,我不确定它用于计算差异的方法。也许它将其与当前的登台桶中的文件进行了比较,如果删除了登台桶中的文件(它们的默认寿命为15天),它将再次部署所有文件(但是正如我说的那样,我是我说的不确定)
For a site where new URLs are being created regularly (like a news, blog site, etc), don't 'store' your sitemap. It should be generated on demand i.e. your App should include code to generate the content when the link
<your_website>/sitemap.xml
is loaded.Separately, you should note that
gcloud app deploy
doesn't always deploys all your files. It usually deploys only files that have changed. You can easily confirm this by running the deploy command, changing a single file and then running the deploy command again. You will see that the logs will say something like -Uploading 1 files to Google Cloud Storage
and the deploy will be faster. You can changeX
number of files, deploy again and the message will be updated to indicate it is only deployingx
files.However, I'm not sure what it uses to compute the diff. Maybe it compares it to the files currently in your staging bucket and if the files in the staging bucket have been deleted (they have a default life span of 15 days) it will deploy all the files again (but as I said, I'm not sure of this)