1

I'm putting together some user guides using Sphinx. However, there are a number of .rst files and it's getting quite difficult to keep track of them when they are all in the main folder along with index.rst.

I'd like to organize them into folders like so. But then, the make html command results in warnings saying it can't find all those .rst files tucked away within folders.

How can I organise my .rst files?

index.rst
  Docs
     new_starter.rst
     subject_guides.rst
  New starter
     first_week.rst
     second_week.rst
  Subject guides
     stress.rst
     aerodynamics.rst
     data_science.rst
mzjn
  • 48,958
  • 13
  • 128
  • 248
bluprince13
  • 4,607
  • 12
  • 44
  • 91
  • Related: http://stackoverflow.com/questions/10199233/can-sphinx-link-to-documents-that-are-not-located-in-directories-below-the-root/17217041#17217041 – Sohaib Farooqi Mar 26 '17 at 19:11

1 Answers1

3

This is mentioned in the Sphinx documentation section TOC Tree.

In your index.rst, use the toctree directive:

Project Awesome
===============

Welcome to the Project Awesome docs.

.. toctree::
   :glob:
   :maxdepth: 2

   docs/*
   new_starter/*
   subject_guides/*

The above uses "globbing", but you can explicitly order the files using their names instead of globbing.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • I tried that. It requires a ``:glob: `` by the way. I still have the problem that the side bar doesn't load up properly. – bluprince13 Mar 30 '17 at 19:59
  • What do you expect and observe? What is "properly"? It could be a theme issue. – Steve Piercy Mar 31 '17 at 09:39
  • I'm using the ``readthedocs`` theme. The side bar wasn't updating itself and showing lower levels as I navigate through the docs. However, I did find a fix: I deleted the build files and ran `make html` again. It's working now :) – bluprince13 Mar 31 '17 at 13:59
  • 2
    Ah, yes. Sphinx uses a cache and rebuilds only the changed files. `make clean html` instead of `make html` should also take "clean" the cache. – Steve Piercy Mar 31 '17 at 20:08