Adding only one entry to toctree for subdirectory

86 Views Asked by At

The toctree in the index.html page is one level deep when I expect it to be two levels deep.

The project directory structure is like this:

index.md
dlg.md
dlg/about/index.md
dlg/...

The dlg.md page looks like this (in MyST syntax):

```{toctree}
:maxdepth: 1
dlg/about/index
dlg/advanced/index
dlg/advanced_filter/index
... (more entries)

```

# Dialogs page

The dlg.html page is rendered like this as expected.

enter image description here

The index.md page looks like this. Note that I tried using maxdepth to fix my issue.:

```{toctree}
:maxdepth: 1
dlg

```

index.html is rendered like this:

enter image description here

Note how the Dialogs page entry is the last entry in the toctree, and that all entries are on one level. I was expecting the toctree to look like this:

- Dialogs page
    - About EmEditor dialog box
    - ...

Therefore I thought that using :maxdepth: 1 would only show Dialogs page and hide the rest. How do I make it so that only Dialogs page is shown in the table of contents for index.html?

1

There are 1 best solutions below

0
On BEST ANSWER

I fixed the issue by rearranging the title. I moved the # Dialogs page line to the top of the page, before the toctree. Now the dlg.md file looks like:

# Dialogs page

```{toctree}
:maxdepth: 1
dlg/about/index
dlg/advanced/index
dlg/advanced_filter/index
... (more entries)

```

Now the index.html page looks as I originally wanted it to.