Skip to content

[Bug]: Warning is issued when a document is added to multiple parents #1277

@wouterj

Description

@wouterj

Summary

Guides does not support adding a document to 2 different parents in the toctree. This is supported by Sphinx.

Although probably not relevant, the warnings that are issued create a lot of noise when building the Symfony docs: https://github.com/wouterj/symfony-docs-guides/actions/runs/19391242509/job/55484996045

Code snippet that reproduces the problem

Create a small doc with a toctree like this:

index.rst
├─ design.rst
├─ implementation.rst
│  ├─ design.rst
│  └─ test.rst
└─ release.rst
Rst files
.. index.rst

Homepage
========

.. toctree::

    design
    implementation
    release
.. implementation.rst

Implementation
==============

.. toctree::

    design
    test

design.rst, release.rst and test.rst are empty

The design.rst now has both Index and Implementation as parents.
This triggers a warning with Guides:

app.WARNING: Document design has been added to parents index and implementation. The `toctree`
directive changes the position of documents in the document tree. Use the `menu` directive to
only display a menu without changing the document tree.

Expected output

Sphinx accepts the doc structure, and generates a toctree order like this:

  1. index
  2. design
  3. implementation
  4. test
  5. release

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions