sitemaps.xml在asp.net mvc的 [英] sitemaps.xml in asp.net mvc
问题描述
我的网站已经动态内容,正在创造新的链接。
My website has dynamic content, new links are being created.
我的数据库有哪些pretty多少包含了所有添加的URL的表。
my db has a table which pretty much contains all the added urls.
所以我的问题是如何importnt它是对我有sitemaps.xml,也有来构建它,以便生成时新的链接我可以标记一个sitemap.xml的文件的末尾一个简单的方法?
So my question is how importnt is it for me to have sitemaps.xml, and also is there a simple way to build it so that when new links are generated i can tag it to the end of a sitemap.xml file?
推荐答案
您可以使用LINQ到XML从数据库中创建一个XML站点地图,然后通过返回内容从操作返回站点地图(文件的ToString(),文/ XML)
。
You can use LINQ to XML to create an XML sitemap from your database, then return the sitemap from an action by returning Content(document.ToString(), "text/xml")
.
这篇关于sitemaps.xml在asp.net mvc的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!