ColdFusion PingSitemaps help web crawlers to do a better job of crawling your site. If your content is continously updated, then you should let the search engines know that your XML file of all your site links has been updated. To date, Ask, Google, MSN, and Yahoo support the Sitemap 0.90 protocol. Visit sitemaps.org for the sitemap XML format, if you haven’t already created one. There are also websites that will create a sitemap for you.

Here is a solution you can use in your ColdFusion applications which will alert the four major search engines that your sitemap has been refreshed.

The code is fairly easy. First, we wrap our code in a <cftry> with a <cfcatch> if something goes wrong. Then, we use the <cfhttp> tag to send a request to the sitemap ping service specified by the particular search engine. The "redirect" attribute is important because, by default, <cfhttp> will redirect to the URL specified in the tag. We choose "no" to allow for multiple pings in one process. After the ping is made to the service we set a variable for the header status code. 200 OK is a successful request and 404 Not Found means the page was not accessed. Once all of the selected pings have run, the use <cfmail> to email the results.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
&lt;cftry&gt;
<cfhttp url = "http://submissions.ask.com/ping?sitemap=
http://YOURDOMAIN/sitemap.xml"
        redirect = "no">
</cfhttp>
<cfset AskPingStatus = cfhttp.statusCode&gt;
<cfhttp url = "http://www.google.com/webmasters/sitemaps/ping?sitemap=
http://YOURDOMAIN/sitemap.xml"
        redirect = "no">
</cfhttp>
<cfset GooglePingStatus = cfhttp.statusCode&gt;
<cfhttp url = "http://webmaster.live.com/ping.aspx?sitemap=
http://YOURDOMAIN/sitemap.xml"
        redirect = "no">
</cfhttp>
<cfset MSNPingStatus = cfhttp.statusCode&gt;
<cfhttp url = "http://search.yahooapis.com/SiteExplorerService/V1/ping?
sitemap=http://YOURDOMAIN/sitemap.xml"
        redirect = "no">
</cfhttp>
<cfset YahooPingStatus = cfhttp.statusCode&gt;
 
<cfmail to = "you@gmail.com"
	   from = "info@YOURDOMAIN"
	   subject = "Multiple Site Map Ping Results"
	   type = "html">
Ask: #AskPingStatus#<br/>        
Google: #GooglePingStatus#<br/>
MSN: #MSNPingStatus#<br/>
Yahoo: #YahooPingStatus#<br/>
</cfmail>
 
     <cfcatch type="any">
<cfmail to = "you@gmail.com"
	   from = "info@YOURDOMAIN"
             subject = "Multiple Site Map Ping Error"
             type = "html">
     #cfcatch#
     </cfmail>
     </cfcatch>
</cftry>

This code can be run either when a sitemap is updated, or as a scheduled task. I prefer to ping the sitemap services when I create my feed.

Did you find this ColdFusion code useful? Let me know.

7 Responses to “How to Use ColdFusion to Ping the Ask, Google, MSN, and Yahoo Sitemap Services”

  1. sho'fr Says:

    ahh, very clever use of coldfusion. as much as the big 4 claim to listen to your robots.txt file, they have allot of room to improve.

    your readers may appreciate a quick refresher on the basics of creating a proper sitemap.xml file: http://blog.shofr.com/2007/development/seo-101-sitemaps/

  2. Suchmaschinenoptimierung Says:

    have you the link for german language too? if yes - please post here.

  3. Jason Bartholme Says:

    Hello Suchmaschinenoptimierung,

    I believe the URL to ping Google is as follows:

    http://www.google.de/webmasters/sitemaps/ping?sitemap=
    http://YOURDOMAIN/sitemap.xml

    As for the others I don’t, know but I can ask around for you.

  4. management Says:

    thanks for the info this can be very useful.
    is this needed for google if you use the webmaster tools?
    Can this be saved as a php file and after updating my sitemap I can just run the file from the browser?
    Thanks!

  5. Scotty Says:

    You could use crawlscore.com to generate the sitemaps on a regular basis.

  6. Using ColdFusion to Ping Sitemap Services | Fusion Team Blog Says:

    [...] engines when your sitemap changes. The process is know as pinging and the example is provided on Jason Bartholme’s SEO Blog. Worth a look as can be useful for prompting the search engines to come and crawl your site until [...]

  7. Suchmaschinenoptimierung Says:

    Thanks for the Link Jason!

Leave a Reply


Warning: stristr() [function.stristr]: Empty delimiter. in /nfs/c02/h04/mnt/40765/domains/jasonbartholme.com/html/wp-content/plugins/wassup/wassup.php on line 2093