用js生成动态站点地图? [英] Generate dynamic sitemap with js?

查看:257
本文介绍了用js生成动态站点地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型站点,它具有一些动态选项卡式内容,这些内容通过AJAX请求从JSON文件加载并用于填充DOM,这些选项卡本身以及其中包含的内容都是通过此方式即时生成的JSON.这些都与History.js捆绑在一起,因此每个选项卡都可以通过URL添加书签和索引:?state = whatever.

I have a small site, it has a bit of dynamic tabbed content which is loaded from a JSON file via an AJAX request and used to populate the DOM, the tabs themselves and content they contain are all generated on the fly from this JSON. This is all tied together with History.js so each tab is bookmarkable and indexable via a url: ?state=whatever.

我现在正在寻找一个sitemap.xml提交给Google,其中包含相关标签的所有URL.

I'm now looking to put together a sitemap.xml to submit to Google which contains all the URLs for the relevant tabs.

但是,该站点没有服务器端处理,所有静态内容都在S3存储桶中提供.

However, There is no server-side processing for the site, it is all static content served up in an S3 bucket.

我正在寻找一种方法,使用纯字体末端技术从用于填充各个标签的同一JSON文件生成站点地图.

I'm looking to see if there is a way, using purely font-end technologies to generate the sitemap from the same JSON file which is used to populate the various tabs.

有什么想法或建议吗?

谢谢

罗伯特

推荐答案

要使机器人使用您的sitemap.xml,它必须是服务器上的实际文件.

For a bot to use your sitemap.xml, it has to be an actual file living on your server.

要创建文件,您将需要服务器端语言来动态创建它.可以是PHP,ColdFusion,.NET或任何您喜欢的东西.

To create the file, you will need a server-side language to create it dynamically. This could be PHP, ColdFusion, .NET or whatever you like.

这就是我要做的:

将JSON对象(保存站点中的链接)发布到AJAX请求,服务器端脚本中,该脚本将获取此数据,然后生成一个名为sitemap.xml的文件.

Post your JSON object (holding your links in the site) to an AJAX request, to a server-side script that will take this data and then generate a file called sitemap.xml.

这有帮助吗?抱歉,如果我误解了您的问题.

Does that help? Sorry if I am mis-understanding your question.

这篇关于用js生成动态站点地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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