How to change titles in a toctree using glob?

1k views Asked by At

I use in my sphinx project a toctree with glob option and I want to show different titles than the H1 of my file or the name of the file with using Titlesonly as option of toctree.

Here is a snap of my code :

in the index.md there is README.md files of my project

```{toctree}
---
maxdepth: 1
glob:
---
src/*/*

I want to show the 'Project Root' for example 'audit' instead of the title of the file 'Projet audit @shared'

Here is a snap of README.md

# Projet audit @shared

* Project Root: `audit`
1

There are 1 answers

2
Steve Piercy On BEST ANSWER

You cannot specify the document titles using glob. The syntax for showing custom titles in reST is described in the documentation.

Entries

Document titles in the toctree will be automatically read from the title of the referenced document. If that isn’t what you want, you can specify an explicit title and target using a similar syntax to reST hyperlinks (and Sphinx’s cross-referencing syntax). This looks like:

.. toctree::

    intro
    All about strings <strings>
    datatypes