Reads your sitemap daily, submits the pages that are new or changed for indexing, and records every submission in a sheet.
Uses
Google Sheets
Tell search engines about your new pages
sitemapUrl to blank.Set sitemapUrl to blank.indexNowKey to blank.Set indexNowKey to blank.spreadsheetUrl to blank.Set spreadsheetUrl to blank.sheetTab to Index submissions.Set sheetTab to Index submissions.maxPagesPerRun to 25.Set maxPagesPerRun to 25.keyFileUrl to blank.Set keyFileUrl to blank.indexNowEndpoint to https://api.indexnow.org/indexnow.Set indexNowEndpoint to https://api.indexnow.org/indexnow.pageLimit to maxPagesPerRun multiplied by 1.Set pageLimit to maxPagesPerRun multiplied by 1.pageLimit is greater than or equal to 1 is noIf pageLimit is greater than or equal to 1 is noYes
maxPagesPerRun.Stop and report a problem: Set the 'maxPagesPerRun' step to how many pages may be submitted in one run, as a whole number - for example 25. It is currently: maxPagesPerRun.No
No steps
pageLimit is greater than 500If pageLimit is greater than 500Yes
maxPagesPerRun.Stop and report a problem: The 'maxPagesPerRun' step is set higher than 500. Search engines throttle and then ignore bulk submissions, so keep it at 500 or fewer. It is currently: maxPagesPerRun.No
No steps
indexNowKey and save it as submissionKey.Trim indexNowKey and save it as submissionKey.sitemapUrl split by :// split by / and save it as siteHost.Get the first item of the last item of sitemapUrl split by :// split by / and save it as siteHost.siteHost is emptyIf siteHost is emptyYes
sitemapUrl.Stop and report a problem: Could not work out which site the 'sitemapUrl' step belongs to. It should look like https://example.com/sitemap.xml, not: sitemapUrl.No
No steps
keyFileUrl and save it as keyLocation.Trim keyFileUrl and save it as keyLocation.keyLocation is emptyIf keyLocation is emptyYes
keyLocation to https://@siteHost/@submissionKey.txt.Change keyLocation to https://@siteHost/@submissionKey.txt.No
No steps
sitemapText to blank.Set sitemapText to blank.sitemapReadErrorIf a step below fails, save the error as sitemapReadErrorTry
sitemapUrl and save it as sitemapResponse.Fetch sitemapUrl and save it as sitemapResponse.sitemapResponse.body and save it as sitemapText.Trim sitemapResponse.body and save it as sitemapText.On error
sitemapReadError.message with sitemapUrl replaced by the sitemap address.Stop and report a problem: Could not read the sitemap in the 'sitemapUrl' step. sitemapReadError.message with sitemapUrl replaced by the sitemap address.sitemapText contains <sitemapindexIf sitemapText contains <sitemapindexYes
No
No steps
sitemapText doesn't contain <loc>If sitemapText doesn't contain <loc>Yes
No
No steps
& with & in sitemapText and save it as sitemapText.Replace & with & in sitemapText and save it as sitemapText.sitemapText split by <loc> from item 2 on and save it as sitemapEntries.Take sitemapText split by <loc> from item 2 on and save it as sitemapEntries.tabIsNew to false.Set tabIsNew to false.createTabErrorIf a step below fails, save the error as createTabErrorTry
sheetTab in spreadsheetUrl.Create the tab sheetTab in spreadsheetUrl.tabIsNew to true.Change tabIsNew to true.On error
tabIsNew is yesIf tabIsNew is yesYes
sheetTab in spreadsheetUrl.Add a row to sheetTab in spreadsheetUrl.No
No steps
alreadySubmitted.Start an empty list and save it as alreadySubmitted.historyReadErrorIf a step below fails, save the error as historyReadErrorTry
spreadsheetUrl. Save it as history.Read the rows of spreadsheetUrl. Save it as history.loggedRow in history.rows:For each loggedRow in history.rows:loggedKey to blank. Set loggedKey to blank.loggedRowError If a step below fails, save the error as loggedRowErrorTry
loggedRow["Page URL"] isn't blankIf loggedRow["Page URL"] isn't blankYes
loggedKey to loggedRow["Page URL"] @ loggedRow["Last modified"].Change loggedKey to loggedRow["Page URL"] @ loggedRow["Last modified"].No
No steps
On error
Skipping a record row that has no 'Page URL' and 'Last modified' value..Show in the output: Skipping a record row that has no 'Page URL' and 'Last modified' value..loggedKey isn't empty If loggedKey isn't emptyYes
loggedKey to the end of alreadySubmitted and save it as alreadySubmitted.Add loggedKey to the end of alreadySubmitted and save it as alreadySubmitted.No
No steps
On error
historyReadError.message.Show in the output: Could not read what has been submitted before, so every page in the sitemap is being treated as new. historyReadError.message.pendingPages.Start an empty list and save it as pendingPages.pendingKeys.Start an empty list and save it as pendingKeys.unchangedCount to 0.Set unchangedCount to 0.sitemapEntry in sitemapEntries:For each sitemapEntry in sitemapEntries:pendingPages is greater than or equal to pageLimitIf the length of pendingPages is greater than or equal to pageLimitYes
No
No steps
sitemapEntry doesn't contain </loc>If sitemapEntry doesn't contain </loc>Yes
No
No steps
sitemapEntry split by </loc> and save it as pageUrl.Extract the first web address from the first item of sitemapEntry split by </loc> and save it as pageUrl.pageUrl is emptyIf pageUrl is emptyYes
No
No steps
lastModified to blank.Set lastModified to blank.sitemapEntry contains <lastmod>If sitemapEntry contains <lastmod>Yes
sitemapEntry split by <lastmod> split by </lastmod> and save it as lastModified.Trim the first item of the last item of sitemapEntry split by <lastmod> split by </lastmod> and save it as lastModified.No
No steps
pageKey to pageUrl @ lastModified.Set pageKey to pageUrl @ lastModified.alreadySubmitted contains pageKeyIf alreadySubmitted contains pageKeyYes
unchangedCount.Add 1 to unchangedCount.No
No steps
pendingKeys contains pageKeyIf pendingKeys contains pageKeyYes
No
No steps
pendingPages and save it as pendingPages.Add a record of url and lastModified to the end of pendingPages and save it as pendingPages.pageKey to the end of pendingKeys and save it as pendingKeys.Add pageKey to the end of pendingKeys and save it as pendingKeys.pendingPages is emptyIf pendingPages is emptyYes
unchangedCount page(s) in the sitemap have already been submitted at their current last-modified date.Finish the run: Nothing to submit: all unchangedCount page(s) in the sitemap have already been submitted at their current last-modified date.No
No steps
submissionUrls.Start an empty list and save it as submissionUrls.pendingPage in pendingPages:For each pendingPage in pendingPages:pendingPage.url to the end of submissionUrls and save it as submissionUrls.Add pendingPage.url to the end of submissionUrls and save it as submissionUrls.submissionStatus to 0.Set submissionStatus to 0.submissionAccepted to false.Set submissionAccepted to false.submissionErrorIf a step below fails, save the error as submissionErrorTry
indexNowEndpoint and save it as submission.Send data to indexNowEndpoint and save it as submission.submissionStatus to submission.status.Change submissionStatus to submission.status.submissionAccepted to submission.ok.Change submissionAccepted to submission.ok.On error
submissionError.message with indexNowEndpoint replaced by the indexing endpoint Nothing was recorded, so the next run will offer these pages again.Stop and report a problem: Could not reach the search engine indexing endpoint. submissionError.message with indexNowEndpoint replaced by the indexing endpoint Nothing was recorded, so the next run will offer these pages again.submissionAccepted is noIf submissionAccepted is noYes
submissionStatus). Check that keyLocation opens in a browser and contains exactly the key from the 'indexNowKey' step. Nothing was recorded, so the next run will offer these pages again.Stop and report a problem: The indexing endpoint refused the submission (HTTP submissionStatus). Check that keyLocation opens in a browser and contains exactly the key from the 'indexNowKey' step. Nothing was recorded, so the next run will offer these pages again.No
No steps
submittedOn.Get today's date and save it as submittedOn.submissionResult to Accepted (HTTP submissionStatus).Set submissionResult to Accepted (HTTP submissionStatus).submittedPage in pendingPages:For each submittedPage in pendingPages:recordErrorIf a step below fails, save the error as recordErrorTry
sheetTab in spreadsheetUrl.Add a row to sheetTab in spreadsheetUrl.On error
submittedPage.url, so the next run will offer it again. recordError.message.Show in the output: Submitted but could not record submittedPage.url, so the next run will offer it again. recordError.message.pendingPages new or changed page(s) for indexing and left unchangedCount unchanged page(s) alone.Show in the output: Submitted the length of pendingPages new or changed page(s) for indexing and left unchangedCount unchanged page(s) alone.