I have a Python project using Sphinx for docs. I am building the docs remotely on readthedocs.io service.
I used sphinx-quickstart
and it generated an index.rst
file with these links in the footer:
Indices and tables
~~~~~~~~~~~~~~~~~~
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
When I push changes to readthedocs.io and build the docs, my build succeeds. Docs that I manually linked via toctree
directive all work fine.
The search
link works fine.
But the genindex
link goes to an empty page, titled "Index"
And the modindex
page links to py-modindex.html
, which is a 404.
Following this guide: https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs I had run sphinx-apidoc -o api-docs/ ../myproject
to generate the autodoc .rst files.
I linked the resulting api-docs/modules.rst
in the toctree
section at the top of my index.rst
... That link works and if I click through the api-docs
have been generated correctly.
Also generated by sphinx-autodoc
were files for each package in my project, they contain directives like:
myproject.whatever module
-------------------------
.. automodule:: myproject.whatever
:members:
:undoc-members:
:show-inheritance:
If I browse directly to these pages they have content, but they don't appear in the index (only the tocs they are manually linked in).
I also have some manually authored pages, again linked via toc.
My docs/conf.py
looks like:
import os
import sys
sys.path.insert(0, os.path.abspath("../"))
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_theme = "alabaster"
html_static_path = ["_static"]
I believe the fact that html generated from the autodoc .rst
stub files are filled with modules and classes extracted from the .py
files in my project indicates that the sys path fix and autodoc are basically working.
So my question is:
- How to make
:ref:`genindex`
have some content? - How to fix
:ref:`modindex`
points topy-modindex.html
which does not exist?