OnlyAI SEO

Documentation

Sitemaps, the news sitemap and the Google indexing script

Accurate sitemaps, good internal links and good content are what get pages found and indexed. This page covers the sitemaps OnlyAI SEO builds and the optional script for telling Google about new addresses quickly.

The sitemaps

Your sitemap index is at /sitemap_index.xml (and is added to robots.txt). It lists one XML sitemap per content type and taxonomy (1,000 addresses per file, with last-modified dates and images), a video sitemap and a news sitemap. Anything marked noindex, password protected or not published is left out. If Yoast, Rank Math or another SEO plugin already builds your sitemap, OnlyAI SEO does not build a second one.

The Google News sitemap

/news-sitemap.xml lists posts published in the last 48 hours, newest first, up to 1,000, the way Google News expects: the address, your site name as the publication, the language (a two-letter code taken from your site language), the publication date in UTC and the title. It follows these rules, which are checked by an automated test:

  • Posts older than 48 hours, drafts, scheduled posts, password-protected posts, pages and anything set to noindex are not listed.
  • A post you publish appears in it straight away, and one you trash disappears straight away. The file is also refreshed at least every 15 minutes as the 48-hour window moves.
  • Titles have their HTML removed and are escaped, so a title with an ampersand or quotes cannot break the XML.
  • It is listed in the sitemap index. Submit /news-sitemap.xml in Google Search Console as well, and make sure your publication is approved in Google Publisher Center: the sitemap alone does not put a site into Google News.
  • To include a custom post type, use the onlyai_seo_sitemap_news_post_types filter. To switch the news sitemap off, use the switch in the sitemap settings.

The Google indexing script (optional, Python)

The plugin folder holds tools/google-indexer/onlyai_google_indexer.py. It reads your sitemap (index, news, video, gzipped) and sends the addresses to the Google Indexing API, remembering what it already sent so it never wastes quota.

pip install google-auth requests

# see what would be sent (needs no key and sends nothing)
python onlyai_google_indexer.py submit --dry-run --sitemap https://example.com/sitemap_index.xml

# send for real
python onlyai_google_indexer.py submit --key service-account.json --sitemap https://example.com/sitemap_index.xml

# keep checking every 15 minutes and send new posts as they appear
python onlyai_google_indexer.py watch --key service-account.json --sitemap https://example.com/news-sitemap.xml --interval 15

# ask Google what it last recorded for an address
python onlyai_google_indexer.py status --key service-account.json --url https://example.com/my-post/
  • Set-up. Create a service account in Google Cloud, enable the Web Search Indexing API, download its JSON key and add the service account's email as an owner of your site in Search Console (Settings, Users and permissions). A 403 error almost always means that last step is missing.
  • Quota. Google's default is 200 addresses a day. The script counts them (the quota resets at midnight Pacific time), sends the newest first, stops when the day's limit is reached and stops at once on a 403 or 429. Use --limit, --since 2d, --match and --exclude to narrow what is sent.
  • What counts as new. An address is sent again only when its last-modified date changes (a news sitemap's publication date counts), or, with no date, after 7 days (--resubmit-days). Delete notices are sent with the delete command.
  • Be aware. Google documents the Indexing API for job posting and livestream pages only. It often accepts other addresses, but that use is outside Google's documented policy, Google can withdraw access, and a successful call does not guarantee faster crawling or indexing. For a news site the news sitemap, Search Console and fast, well-linked pages matter far more.