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.

Ciaran
  • 1,904
  • 16
  • 27
  • 2
    I voted to close this question because it is not a programming question and it is off-topic on Stack Overflow. Non-programming questions about your website should be asked on [webmasters.se]. In the future, please ask questions like this there. – Stephen Ostermiller Apr 06 '22 at 17:39
  • See also: [Should I ping to Google sitemap-index.xml or only the sitemap file that has been modified?](https://webmasters.stackexchange.com/questions/25422/should-i-ping-to-google-sitemap-index-xml-or-only-the-sitemap-file-that-has-been) and [Is it okay to ping Google multiple times in a day when my sitemap is updated?](https://webmasters.stackexchange.com/questions/112153/is-it-okay-to-ping-google-multiple-times-in-a-day-when-my-sitemap-is-updated) – Stephen Ostermiller Apr 06 '22 at 17:40

5 Answers5

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.

Husni
  • 1,045
  • 9
  • 12
  • 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. – Neograph734 Dec 17 '12 at 00:41
  • @Neograph734 just added an info taken from the URL I gave. – Husni Dec 17 '12 at 02: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.

beggs
  • 4,185
  • 2
  • 30
  • 30
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.

user2357169
  • 109
  • 2
  • 9
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

milkovsky
  • 8,772
  • 4
  • 28
  • 32
0

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

Source

Jay
  • 1,086
  • 11
  • 25