WARNING: document isn't included in any toctree for included file

NickChase picture NickChase · Mar 6, 2013 · Viewed 37.5k times · Source

I'm getting the warning:

WARNING: document isn't included in any toctree

for files that exist in the document because they've been explicitly included. So I have the index file:

.. toctree::
    :maxdepth: 2

   pages/0010-foo
   pages/0020-bar

In the file 0020-bar.rst, I'm specifically including a number of other files, as in:

.. contents:: :local:

.. include:: /pages/reference-architecture/technical-considerations/0070-baz.rst

But when I build the project, I still get a warning that 0070-baz.rst isn't in any toctree, as in:

/home/nick/Documents/myProject/docs/pages/reference-architecture/technical-considerations/0070-baz.rst:: WARNING: document isn't included in any toctree

The weird thing is that I can see the content in the output. Is this normal? Does this warning always appear for files that are explicitly included rather than included via toctree?

Thanks!

Answer

Joakim picture Joakim · Nov 21, 2016

If you only want to ..include:: a document in another document, without having it appear in any toctree.

Add :orphan: to the top of your document to get rid of the warning.

This is a File-wide metadata option. Read more from the Sphinx documentation.