Well, howdy! As with many of my posts lately, I find myself saying that’s it’s been awhile since I’ve posted something. It’s true!
Today, I’d like to walk you through how to bulk submit sitemap URLs to Google Search Console using R and RStudio. Before we begin the process of bulk submitting sitemap URLs, you’ll need a few prerequisites:
Prerequisites to Bulk Sitemap URL Submission: R Setup
- Download and install the appropriate version of R for your system: https://cran.r-project.org/
- For Windows users, search for “rtools”, download and install from the official cran.r-project.org site.
- Mac/other OS users may need to as well for their respective OS. However, my primary machine is Windows (described above) and I’ve been able to use RStudio without issue on a Mac, without installing RTools. Doesn’t mean you don’t need it. ¯\_(ツ)_/¯
- Download and install RStudio from the official site: https://rstudio.com/products/rstudio/download/
SearchConsoleR & Bulk Sitemap Submission in Google Search Console
How we bulk submit XML Sitemap URLs in Google Search Console is made possible by the excellent R package made by Mark Edmondson. Why R and SearchConsoleR? Approachability.
Many readers may find this method much more approachable than trying to get API projects, API keys, and other confusing configuration details just right, to work in Python/Jupyter notebooks. You’ll see what I mean in a minute.
Code for Bulk Sitemap URL Submission in Google Search Console
Below is sample R code for bulk sitemap URL submission in Google Search Console, using R and SearchConsoleR. You can also view my Github gist here.
# Load packages library(searchConsoleR) library(dplyr) library(ggplot2) # Authorize & choose Google profile scr_auth() # Specify website --- FULL URL website <- "https://sample.com" # Submit all manually found sitemaps add_sitemap("https://www.sample.com","https://www.sample.com/sitemap_index.xml") sys.sleep(1) add_sitemap("https://www.sample.com","https://www.sample.com/page-sitemap.xml") sys.sleep(1) add_sitemap("https://www.sample.com","https://www.sample.com/post-sitemap.xml") sys.sleep(1)
The code is fairly straightforward, and sadly, not automated. I’ll be working on an automated, scalable way of submitting all Sitemap URLs for all websites in a given Search Console account.
The one custom touch I’d note here is providing the one second system sleep to proactively avoid running afoul of rate limits, if you’re submitting a lot of URLs.