Cannot Get TOCTREE in Sphinx to Show Link

Haikal Nashuha picture Haikal Nashuha · Dec 29, 2012 · Viewed 9.4k times · Source

I am new to Sphinx. I tried out the tutorial but I failed to generate the link in the contents. The error that I got

C:\Users\mhaikalm\sphinxtest\source\index.rst:11: WARNING: toctree contains refe
rence to document 'intro' that doesn't have a title: no link will be generated
C:\Users\mhaikalm\sphinxtest\source\index.rst:11: WARNING: toctree contains refe
rence to document 'zuhdi' that doesn't have a title: no link will be generated
writing additional files... (0 module code pages) genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 3 warnings.

Build finished. The HTML pages are in build/html.

I have created zuhdi.rst and intro.rst in the same directory as index.rst. How can I put title to the documents?

For your information, my index.rst contains these lines:

Contents:

.. toctree::
   :maxdepth: 2

   intro
   zuhdi

Do the documents must exist for me to put the links in the toctree? The intro.rst and zuhdi.rst is just an empty file.

Answer

inspectorG4dget picture inspectorG4dget · Dec 29, 2012

You are getting this error because you don't have a title in intro.rst.
In order to fix this, add a title to intro.rst. Suppose you want your title to be My Title, then the title can be added by making the following two lines the first lines of intro.rst:

My Title
*********

Note that you must have enough * characters to completely underline your title, else you will get another error about a malformed title or underlining thereof.