mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added support for setting table of contents title via mkdocs.yml
This commit is contained in:
parent
8f382d9799
commit
4bdfef47eb
@ -213,6 +213,19 @@ markdown_extensions:
|
||||
|
||||
The following configuration options are supported:
|
||||
|
||||
`title`{ #toc-title }
|
||||
|
||||
: :octicons-milestone-24: Default: _automatically set_ – This option sets the
|
||||
title of the table of contents navigation in the right sidebar, which is
|
||||
normally automatically sourced from the translations for the [site language]
|
||||
as set in `mkdocs.yml`:
|
||||
|
||||
``` yaml
|
||||
markdown_extensions:
|
||||
- toc:
|
||||
title: On this page
|
||||
```
|
||||
|
||||
`permalink`{ #toc-permalink }
|
||||
|
||||
: :octicons-milestone-24: Default: `false` – This option adds an anchor link
|
||||
@ -301,6 +314,7 @@ own risk.
|
||||
|
||||
[Table of Contents]: https://python-markdown.github.io/extensions/toc/
|
||||
[Table of Contents support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
||||
[site language]: ../changing-the-language.md#site-language
|
||||
[Slugs]: https://facelessuser.github.io/pymdown-extensions/extras/slugs/
|
||||
|
||||
### Tables
|
||||
|
@ -2,7 +2,11 @@
|
||||
This file was automatically generated - do not edit
|
||||
-#}
|
||||
{% import "partials/language.html" as lang with context %}
|
||||
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
||||
{% set title = title | default(lang.t("toc.title")) %}
|
||||
{% if "toc" in config.mdx_configs and config.mdx_configs.toc.title %}
|
||||
{% set title = config.mdx_configs.toc.title %}
|
||||
{% endif %}
|
||||
<nav class="md-nav md-nav--secondary" aria-label="{{ title }}">
|
||||
{% set toc = page.toc %}
|
||||
{% set first = toc | first %}
|
||||
{% if first and first.level == 1 %}
|
||||
@ -11,7 +15,7 @@
|
||||
{% if toc %}
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
{{ lang.t("toc.title") }}
|
||||
{{ title }}
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
{% for toc_item in toc %}
|
||||
|
@ -22,8 +22,14 @@
|
||||
|
||||
{% import "partials/language.html" as lang with context %}
|
||||
|
||||
<!-- Determine title -->
|
||||
{% set title = title | default(lang.t("toc.title")) %}
|
||||
{% if "toc" in config.mdx_configs and config.mdx_configs.toc.title %}
|
||||
{% set title = config.mdx_configs.toc.title %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Table of contents -->
|
||||
<nav class="md-nav md-nav--secondary" aria-label="{{ lang.t('toc.title') }}">
|
||||
<nav class="md-nav md-nav--secondary" aria-label="{{ title }}">
|
||||
{% set toc = page.toc %}
|
||||
|
||||
<!--
|
||||
@ -41,7 +47,7 @@
|
||||
{% if toc %}
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
{{ lang.t("toc.title") }}
|
||||
{{ title }}
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
{% for toc_item in toc %}
|
||||
|
Loading…
Reference in New Issue
Block a user