更新的谷歌地图的ASP.NET 3.5 Web应用程序项目 [英] Updateable Google Sitemap for ASP.NET 3.5 Web App Project

查看:136
本文介绍了更新的谷歌地图的ASP.NET 3.5 Web应用程序项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在C#中的ASP.NET 3.5 Web应用程序项目。我手动添加一个谷歌友好的网站地图,其中包括为项目中的每个页面的条目 - 这不是一个CMS

I am working on an ASP.NET 3.5 Web Application project in C#. I have manually added a Google-friendly sitemap which includes entries for every page in the project - this is not a CMS.

  <url>
    <loc>http://www.mysite.com/events.aspx</loc>
    <lastmod>2009-11-17T20:45:46Z</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.8</priority>
  </url>

使用管理员后端的客户端更新的事件。除此之外,该网站是相对静态的。我想以更新的最佳方式决定的&lt;&的lastmod GT;对于网页屈指可数的定期更新值。

The client updates events using an admin back-end. Other than that, the site is relatively static. I'm trying to decide on the best way to update the <lastmod> values for a handful of pages that are regularly updated.

在特定的,我使用的ListView控件的QueryStringField提升SEO如下所述:

In particular, I am using the QueryStringField of the ListView control to enhance SEO as described here:

http://www.4guysfromrolla.com/articles/010610-1.aspx

<一个href=\"http://gsej.word$p$pss.com/2009/05/31/using-a-datapager-with-both-a-querystringfield-and-renderdisabledbuttonsaslabels/\" rel=\"nofollow\">http://gsej.word$p$pss.com/2009/05/31/using-a-datapager-with-both-a-querystringfield-and-renderdisabledbuttonsaslabels/

当QueryStringField属性设置,DataPager的呈现分页界面为一系列的履带能跟随指数和超链接。但是,如果谷歌已经在两天前我爬事件的列表,在此期间,管理员增加了另一个打事件......说的页面大小设置为6;在这种情况下,谷歌SERP链接现在将指向错误的页面。这就是为什么我要肯定的是,网站地图,尽快为他们发生的变化反映到活动页面。

When the QueryStringField property is set, the DataPager renders the paging interface as a series of hyperlinks which the crawler can follow and index. However, if Google has crawled my list of events two days ago, and in the meantime, the admin has added another dozen events... say the page size is set to 6; in this case, the Google SERP links would now be pointing to the wrong pages. This is why I need to be sure that the sitemap reflects changes to the events page as soon as they happen.

我已经看过但其他SO问题的信息,并没有发现我所需要的。任何人都可以提供一些指导或替代办法?

I have already looked though other SO questions for info and didn't find what I needed. Can anyone offer some guidance or an alternative approach?

更新:

由于这是一个共享的托管环境,目录观察家/服务将无法工作:

Since this is a shared hosting environment, a directory watcher/service won't work:

<一个href=\"http://stackoverflow.com/questions/781927/how-to-create-file-watcher-in-shared-webhosting-environment\">http://stackoverflow.com/questions/781927/how-to-create-file-watcher-in-shared-webhosting-environment

更新:

开始意识到,我可能需要表示向谷歌包含页面已经更新;更新最后修改HTTP头?

Starting to realize that I may need signify to Google that the containing page has been updated; update the last-modified HTTP header?

推荐答案

而不是用手工codeD地图,创建一个网站地图的处理程序,将动态生成的地图。您可以创建在将抓住从现有的导航网站地图页面,从数据库,甚至是从页的硬codeD列表的处理方法。您可以从列表中的XmlDocument,写文档的InnerXml到处理程序响应流。

Rather than using a hand-coded sitemap, create a sitemap handler that will generate the sitemap on the fly. You can create a method in the handler that will grab pages from an existing navigation sitemap, from the database, or even from a hard-coded list of pages. You can create an XmlDocument from the list, and write the InnerXml of the document out to the handler response stream.

然后,创建一个类与方法,将自动与上述处理程序的URL平搜索引擎(如的http://www.google.com/webmasters/tools/ping?sitemap=http://www.mysite.com/sitemap.ashx).

Then, create a class with a method that will automatically ping search engines with the above handler's URL (like http://www.google.com/webmasters/tools/ping?sitemap=http://www.mysite.com/sitemap.ashx).

Whever有人添加一个新的事件,调用上面的方法。这将使用最新的地图(通过上述方法新生成的)谷歌ping通

Whever someone adds a new event, call the above method. This will ping Google using your latest sitemap (freshly generated by the above method).

您要确保,如果网站地图实际上已更新了平才起作用。你可以在events.aspx使用File.SetLastWriteTime在AddNewEvent处理程序,以表明包含页面已经更新。

You want to make sure that the ping only works if the sitemap has actually been updated. You could use File.SetLastWriteTime on events.aspx in the AddNewEvent handler to signify that the containing page has been updated.

ASLO,要小心,以确保有一直在为最后一小时无坪(如谷歌指引劝阻侦测每小时超过一次)。

Aslo, be careful to make sure there have been no pings for the last hour (as Google guidelines discourage pinging more than once per hour).

其实,我打算在下面的OSS项目来实现这一点: HTTP://cyclemania.$c$cplex。 COM 。我会让你知道一旦它完成,你可以去看看。

I actually plan to implement this in the following OSS project: http://cyclemania.codeplex.com. I will let you know once it's done and you can have a look.

这篇关于更新的谷歌地图的ASP.NET 3.5 Web应用程序项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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