|
| 1 | +Flyout Menu |
| 2 | +=========== |
| 3 | + |
| 4 | +When you are using a Read the Docs site, |
| 5 | +you will likely notice that we embed a menu on all the documentation pages we serve. |
| 6 | +This is a way to expose the functionality of Read the Docs on the page, |
| 7 | +without having to have the documentation theme integrate it directly. |
| 8 | + |
| 9 | +Functionality |
| 10 | +------------- |
| 11 | + |
| 12 | +The flyout menu provides access to the following bits of Read the Docs functionality: |
| 13 | + |
| 14 | +* A :doc:`version switcher </versions>` that shows users all of the active, unhidden versions they have access to. |
| 15 | +* :doc:`Downloadable formats </downloadable-documentation>` for the current version, including HTML & PDF downloads that are enabled by the project. |
| 16 | +* Links to the Read the Docs dashboard for the project. |
| 17 | +* Links to your :doc:`VCS provider </integrations>` that allow the user to quickly find the exact file that the documentation was rendered from. |
| 18 | +* A search bar that gives users access to our :doc:`/server-side-search` of the current version. |
| 19 | + |
| 20 | +Closed |
| 21 | +~~~~~~ |
| 22 | + |
| 23 | +.. figure:: /_static/images/flyout-closed.png |
| 24 | + |
| 25 | + The flyout when it's closed |
| 26 | + |
| 27 | +Open |
| 28 | +~~~~ |
| 29 | + |
| 30 | +.. figure:: /_static/images/flyout-open.png |
| 31 | + |
| 32 | + The opened flyout |
| 33 | + |
| 34 | +Information for theme authors |
| 35 | +----------------------------- |
| 36 | + |
| 37 | +People who are making custom documentation themes often want to specify where the flyout is injected, |
| 38 | +and also what it looks like. |
| 39 | +We support both of these use cases for themes. |
| 40 | + |
| 41 | +Defining where the flyout menu is injected |
| 42 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 43 | + |
| 44 | +The flyout menu injection looks for a specific selector (``#readthedocs-embed-flyout``), |
| 45 | +in order to inject the flyout. |
| 46 | +You can add ``<div id="readthedocs-embed-flyout">`` in your theme, |
| 47 | +and our JavaScript code will inject the flyout there. |
| 48 | +All other themes except for the ``sphinx_rtd_theme`` have the flyout appended to the ``<body>``. |
| 49 | + |
| 50 | +Styling the flyout |
| 51 | +~~~~~~~~~~~~~~~~~~ |
| 52 | + |
| 53 | +HTML themes can style the flyout to make it match the overall style of the HTML. |
| 54 | +By default the flyout has it's `own CSS file <https://github.com/readthedocs/sphinx_rtd_theme/blob/master/src/sass/_theme_badge.sass>`_, |
| 55 | +which you can look at to see the basic CSS class names. |
| 56 | + |
| 57 | +The example HTML that the flyout uses is included here, |
| 58 | +so that you can style it in your HTML theme: |
| 59 | + |
| 60 | +.. code:: html |
| 61 | + |
| 62 | + <div class="injected"> |
| 63 | + <div class="rst-versions rst-badge shift-up" data-toggle="rst-versions"> |
| 64 | + <span class="rst-current-version" data-toggle="rst-current-version"> |
| 65 | + <span class="fa fa-book"> </span> |
| 66 | + v: 2.1.x |
| 67 | + <span class="fa fa-caret-down"></span> |
| 68 | + </span> |
| 69 | + <div class="rst-other-versions"> |
| 70 | + <dl> |
| 71 | + <dt>Versions</dt> |
| 72 | + <dd> |
| 73 | + <a href="https://flask.palletsprojects.com/en/latest/">latest</a> |
| 74 | + </dd> |
| 75 | + <dd class="rtd-current-item"> |
| 76 | + <a href="https://flask.palletsprojects.com/en/2.1.x/">2.1.x</a> |
| 77 | + </dd> |
| 78 | + </dl> |
| 79 | + <dl> |
| 80 | + <!-- These are kept as relative links for internal installs that are http --> |
| 81 | + <dt>On Read the Docs</dt> |
| 82 | + <dd> |
| 83 | + <a href="//readthedocs.org/projects/flask/">Project Home</a> |
| 84 | + </dd> |
| 85 | + <dd> |
| 86 | + <a href="//readthedocs.org/projects/flask/builds/">Builds</a> |
| 87 | + </dd> |
| 88 | + <dd> |
| 89 | + <a href="//readthedocs.org/projects/flask/downloads/">Downloads</a> |
| 90 | + </dd> |
| 91 | + </dl> |
| 92 | + <dl> |
| 93 | + <dt>On GitHub</dt> |
| 94 | + <dd> |
| 95 | + <a href="https://github.com/pallets/flask/blob/2.1.x/docs/index.rst">View</a> |
| 96 | + </dd> |
| 97 | + <dd> |
| 98 | + <a href="https://github.com/pallets/flask/edit/2.1.x/docs/index.rst">Edit</a> |
| 99 | + </dd> |
| 100 | + </dl> |
| 101 | + <dl> |
| 102 | + <dt>Search</dt> |
| 103 | + <dd> |
| 104 | + <div style="padding: 6px;"> |
| 105 | + <form id="flyout-search-form" class="wy-form" target="_blank" action="//readthedocs.org/projects/flask/search/" method="get"> |
| 106 | + <input type="text" name="q" aria-label="Search docs" placeholder="Search docs"> |
| 107 | + </form> |
| 108 | + </div> |
| 109 | + </dd> |
| 110 | + </dl> |
| 111 | + <hr> |
| 112 | + <small> |
| 113 | + <span>Hosted by <a href="https://readthedocs.org">Read the Docs</a></span> |
| 114 | + <span> · </span> |
| 115 | + <a href="https://docs.readthedocs.io/page/privacy-policy.html">Privacy Policy</a> |
| 116 | + </small> |
| 117 | + </div> |
| 118 | + </div> |
| 119 | + </div> |
0 commit comments