|
| 1 | +:html_theme.sidebar_secondary.remove: true |
| 2 | + |
| 3 | +Test of in-page TOC with no right sidebar |
| 4 | +========================================= |
| 5 | + |
| 6 | +This page tests that the local contents directive looks okay. |
| 7 | + |
| 8 | +.. attention:: |
| 9 | + |
| 10 | + We **do not recommend** using this directive on pages that use this theme |
| 11 | + because PyData Theme provides an in-page table of contents in the right sidebar |
| 12 | + by default. |
| 13 | + |
| 14 | +If you do choose to use an inline, in-page table of contents, we recommend that |
| 15 | +you turn off the right sidebar as follows. |
| 16 | + |
| 17 | +.. contents:: Page contents |
| 18 | + :local: |
| 19 | + |
| 20 | + |
| 21 | +Add a local table of contents (in-page) |
| 22 | +--------------------------------------- |
| 23 | + |
| 24 | +Add the local table of contents directive near the top of your ``.rst`` page: |
| 25 | + |
| 26 | +.. code-block:: rst |
| 27 | +
|
| 28 | + .. contents:: Page contents |
| 29 | + :local: |
| 30 | +
|
| 31 | +This directive will generate a table of contents for the section where this was |
| 32 | +added, as shown on this page. |
| 33 | + |
| 34 | + |
| 35 | +Turn off the right sidebar for a single page |
| 36 | +-------------------------------------------- |
| 37 | + |
| 38 | +On the very top line of your ``.rst`` file, insert the following line: |
| 39 | + |
| 40 | +.. code-block:: rst |
| 41 | +
|
| 42 | + :html_theme.sidebar_secondary.remove: true |
| 43 | +
|
| 44 | +This will render the page without the right sidebar, also known as the secondary |
| 45 | +sidebar, which contains the table of contents for that page. |
| 46 | + |
| 47 | +Be aware that if you remove the sidebar you may also remove the "Edit on ..." |
| 48 | +and "Show source" links for that page, since by default those are configured for |
| 49 | +the right sidebar. |
0 commit comments