generate_robots_txt#

documenteer.ext.robots.generate_robots_txt(app, exception)#

Generate a robots.txt file automatically if conditions are met.

Parameters:
  • app (Sphinx) – The Sphinx application.

  • exception (Exception | None) – Exception raised during build, if any. If not None, the function returns early without generating robots.txt.

Return type:

None

Notes

This function is called during the build-finished Sphinx event. It generates a robots.txt file if:

  1. No robots.txt file already exists in the output directory

  2. A sitemap.xml file exists in the output directory

  3. The html_baseurl configuration is set