Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate different TOCs for subdirectories within the same project in Sphinx #27

Open
ka2in opened this issue Jul 19, 2022 · 0 comments

Comments

@ka2in
Copy link

ka2in commented Jul 19, 2022

Following the instructions about conditional text in Sphinx, I created three different build subdirectories in one project to generate three custom contents from the same source (e.g. source-file -> output1 for users, output2 for admins, output3 for developers).

I'm currently stuck on how to generate three different TOCs for each subdirectory within my project.
In the current scenario, the build command generates a single TOC for all three subdirectories and overwrites the former TOC.

My project consists of a single source directory and three different build directories. My tree structure looks like this:

C:.
|   make.bat
|   Makefile   
+---adminbuild    # Build directory for admins        
+---build         # Build directory for users
+---devbuild      # Build directory for developers
+---env           
\---source
    |	conf.py
    |	contents.rst
    +---pics
    +---_static
    \---_templates
            index.html
            layout.html

As you can see, I have a custom landing page in the _templates folder (i.e., index.html), and a Jinja template (layout.html) extending my default layout.

Here's an extract of my conf.py:

# The master toctree document. Tell Sphinx about the location of our table of contents.
root_doc = 'contents'

# Tell Sphinx that we still want to generate the index page, but with a custom template.
html_additional_pages = {'index': 'index.html'}

Is there a possibility to set multiple values for the root_doc and specify each path within the corresponding subdirectory, or any other workaround to achieve this?

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant