@@ -361,8 +361,6 @@ The switcher requires the following configuration steps:
361
361
``html_theme_options `` dict in ``conf.py ``. ``switcher `` should have 3 keys:
362
362
363
363
- ``json_url ``: the persistent location of the JSON file described above.
364
- - ``url_template ``: a template string used to generate the correct URLs for
365
- the different documentation versions.
366
364
- ``version_match ``: a string stating the version of the documentation that
367
365
is currently being browsed.
368
366
@@ -380,14 +378,11 @@ First, write a JSON file stating which versions of your docs will be listed in
380
378
the switcher's dropdown menu. That file should contain a list of entries that
381
379
each can have the following fields:
382
380
383
- - ``version ``: a version string. This will be inserted into
384
- ``switcher['url_template'] `` to create the links to other docs versions, and
385
- also checked against ``switcher['version_match'] `` to provide styling to the
386
- switcher.
381
+ - ``version ``: a version string. This is checked against
382
+ ``switcher['version_match'] `` to provide styling to the switcher.
383
+ - ``url ``: the URL for this version.
387
384
- ``name ``: an optional name to display in the switcher dropdown instead of the
388
385
version string (e.g., "latest", "stable", "dev", etc).
389
- - ``url ``: an optional URL. If provided, it links the version to ``url ``
390
- instead of ``switcher['url_template'] ``.
391
386
392
387
Here is an example JSON file:
393
388
@@ -396,13 +391,16 @@ Here is an example JSON file:
396
391
[
397
392
{
398
393
"name" : " v2.1 (stable)" ,
399
- "version" : " 2.1"
394
+ "version" : " 2.1" ,
395
+ "url" : " https://mysite.org/en/2.1/index.html"
400
396
},
401
397
{
402
398
"version" : " 2.1rc1" ,
399
+ "url" : " https://mysite.org/en/2.1rc1/index.html"
403
400
},
404
401
{
405
- "version" : " 2.0"
402
+ "version" : " 2.0" ,
403
+ "url" : " https://mysite.org/en/2.0/index.html"
406
404
},
407
405
{
408
406
"version" : " 1.0" ,
@@ -461,28 +459,6 @@ a few different ways:
461
459
}
462
460
463
461
464
- Configure ``switcher['url_template'] ``
465
- --------------------------------------
466
-
467
- The switcher's links to other versions of your docs are made by combining the
468
- *version strings * from the JSON file with a *template string * you provide in
469
- ``switcher['url_template'] ``. The template string must contain a placeholder
470
- ``{version} `` and otherwise be a fully-resolved URL. For example:
471
-
472
- .. code :: python
473
-
474
- html_theme_options = {
475
- ... ,
476
- " switcher" : {
477
- " url_template" : " https://mysite.org/en/version-{version} /" ,
478
- }
479
- }
480
-
481
- The example above will result in a link to
482
- ``https://mysite.org/en/version-1.0/ `` for the JSON entry for version
483
- ``"1.0" ``.
484
-
485
-
486
462
Configure ``switcher['version_match'] ``
487
463
---------------------------------------
488
464
0 commit comments