Use case: my company is looking to provide Google with an updated sitemap (curl Google Webmaster Tools - Sitemap Notification Received) after every production build. However, there are times where the sitemap doesn’t change in between builds. Google doesn’t want us to submit the exact same sitemap if there are no changes to it, so I need to build conditional logic to check to see if the sitemap I generate in the production build is different from the sitemap currently live on the site. If it is, I then run the curl command. But there’s a catch: I need to wait until the full site is live to submit the new sitemap, because if I run the curl command during the production build, it’s just going to submit the old sitemap. Somewhat of a chicken/egg situation.
Basically, I’m looking to do the following:
- Start my production build.
- During the production build, determine if I need to send Google an updated sitemap.
- Wait for the build to finish and the site to go live.
- If step 2 determines I need to submit an updated sitemap, run a post-build script to update the sitemap. If no sitemap changes are necessary, don’t run the script.
Is something like this possible?