@@ -557,6 +557,7 @@ Configuration Options
557557 .. themeconf:: globaltoc_collapse
558558
559559 If true (the default value), TOC entries that are not ancestors of the current page are collapsed.
560+ Collapsed entries cannot be expanded.
560561
561562 .. warning::
562563 Setting this option to `False ` may lead to large generated page sizes since the entire
@@ -787,6 +788,26 @@ aliases. Other required fields include ``version`` and ``title``.
787788 {"version" : " 1.0" , "title" : " 1.0" , "aliases" : []},
788789 ]
789790
791+ To redirect browsers to the latest version, add a ``index.html `` in the same directory as your
792+ project's ``versions.json `` file to be served as the domain's base URL. It should look something
793+ like the following:
794+
795+ .. code-block :: html
796+
797+ <!DOCTYPE HTML>
798+ <html lang =" en" >
799+ <head >
800+ <meta charset =" utf-8" >
801+ <meta http-equiv =" refresh" content =" 0; url=latest/" />
802+ <link rel =" canonical" href =" latest/" />
803+ </head >
804+ <body >
805+ <p >If this page does not refresh automatically, then please direct your browser to
806+ <a href =" latest/" >our latest docs</a >.
807+ </p >
808+ </body >
809+ </html >
810+
790811Customizing the layout
791812======================
792813
@@ -917,7 +938,7 @@ demonstrates using Giscus_ which is Open Source and built on Github's Discussion
917938 ref .addEventListener (" change" , function () {
918939 var palette = __md_get (" __palette" )
919940 if (palette && typeof palette .color === " object" ) {
920- var theme = palette .color .scheme === " slate" ? " dark" : " light" // (3 )!
941+ var theme = palette .color .scheme === " slate" ? " dark" : " light" // (4 )!
921942
922943 /* Instruct Giscus to change theme */
923944 var frame = document .querySelector (" .giscus-frame" )
@@ -940,8 +961,44 @@ demonstrates using Giscus_ which is Open Source and built on Github's Discussion
940961 themes are available, so you can change it to your liking.
941962 #. If changing the dark theme used by Giscus, then also change the dark theme name here as
942963 this takes affect when toggling between light and dark color :themeconf: `scheme `\ s.
964+ #. If changing the dark theme used by Giscus, then also change the dark theme name here as
965+ this takes affect when toggling between light and dark color :themeconf: `scheme `\ s.
9439663. Enable comments for a certain page by adding the :themeconf: `show-comments ` metadata to the document's source.
944967
968+ Version Banner
969+ --------------
970+
971+ If you're using :ref: `version_dropdown `, you might want to display a warning when the user visits
972+ any other version than the latest version. Using a partial template, you can override the
973+ ``outdated `` block with the a new jinja template located in the project's documentation's
974+ ``_templates/base.html ``.
975+
976+ .. code-block :: jinja
977+ :caption: docs/_templates/base.html
978+
979+ {% extends "!base.html" %}
980+
981+ {% block outdated %}
982+ You're not viewing the latest version.
983+ <a href="{{ '../' ~ base_url}}">
984+ <strong>Click here to go to latest.</strong>
985+ </a>
986+ {% endblock %}
987+
988+ .. example :: Changing the color of the banner in dark scheme
989+ :collapsible:
990+
991+ Depending on the project's choices for :themeconf: `palette ` colors, it might make the banner's
992+ text more legible to change the background color of the banner.
993+
994+ .. code-block :: css
995+ :caption: docs/_static/extra_style.css
996+
997+ /* only override for dark/slate scheme */
998+ [data-md-color-scheme = " slate" ] .md-banner--warning {
999+ background : var (--md-footer-bg-color );
1000+ }
1001+
9451002 New Blocks
9461003**************
9471004This theme has a few new block inherited from the mkdocs-material theme:
0 commit comments