31

As you may know, by using the following url, you can 'ping' google to update its record of your sitemap:

https://www.google.com/ping?sitemap=URLOFSITEMAP.xml

I made a script to do this programmatically after every article submission (I am making a user submitted blog type site).

Do you think its a bad idea to do this after every submission and would it be better to do this daily or after some interval?

I guess this would come down to whether or not there is a chance that doing this would stall the application execution. The pinging is not done asynchronously so I guess there is always a chance. I was just wondering if anybody has implemented this programmatically and what his/her approach was.

2

5 Answers 5

28

Yes, that method is allowed by google.

  1. Issue your request to the following URL:

    www.google.com/webmasters/tools/ping?sitemap=sitemap_url

    For example, if your Sitemap is located at http://www.example.com/sitemap.gz, your URL will become:

    www.google.com/webmasters/tools/ping?sitemap=http://www.example.com/sitemap.gz

  2. URL encode everything after the /ping?sitemap=:

    www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2Fwww.yoursite.com%2Fsitemap.gz

  3. Issue the HTTP request using wget, curl, or another mechanism of your choosing.

ADDED:

Based on the link I just given, there is an info in there, google says:

We recommend that you resubmit a Sitemap no more than once per hour.

2
  • 1
    You are not fully answering his question... he wants to know if it would be good to do this several times, ofr just once. He already had the ping function. Dec 17, 2012 at 0:41
  • @Neograph734 just added an info taken from the URL I gave.
    – Husni
    Dec 17, 2012 at 2:15
2

Take a look at the code for the Google Sitemap Generator Plugin for Wordpress. A lot of people use that and it does not seem to slow things down enough to notice. Whatever methodology they are using should be a good place to start.

2

As of 2015, Google no longer suggests a rate limit in their documentation.

It is in Google's best interest to know when fresh articles are created so it is worth pinging them with your sitemap, or at least some kind of "Fresh Articles" sitemap when new articles are published.

Googlebot will request your sitemap every time your ping it. It sends requests headers to check the newness of the resource. So if you plan on submitting a sitemap frequently, make sure your server will handle the request correctly. Otherwise, you might return a 304 (Not Modified) and Googlebot won't actually get the file.

1

There is no need to resubmit sitemaps anymore. According to Google this approach is outdated since 2020:

Resubmit a sitemap

You shouldn't need to resubmit a sitemap that we already know about, even if you've changed it. Google will notice any changes the next time we crawl your site.

You can check this article: Manage your sitemaps using the Sitemaps report in http://web.archive.org/.

2020:

enter image description here

2016:

enter image description here

0

The Yoast plugin automatically pings Google and Bing when a post is updated.

Source