Using the following config file and sample markdown structure:
mkdocs.yml
```
site_name: "Test doc"
site_url: "http://localhost"
repo_name: test
edit_uri: ""
docs_dir: "test"
site_dir: "test_site"
use_directory_urls: false
theme:
name: 'material'
palette:
- scheme: default
toggle:
icon: material/toggle-switch-off-outline
name: Dark mode
- scheme: slate
toggle:
icon: material/toggle-switch
name: Light mode
features:
- navigation.instant
- navigation.indexes
- navigation.top
- toc.integrate
nav:
- Main:
- 'index.md'
- Sub:
- 'sub/index.md'
extra:
custom_var: 'Custom name'
markdown_extensions:
- admonition
- pymdownx.b64
- pymdownx.highlight
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.mark
- pymdownx.details
- mdx_truly_sane_lists
- attr_list
- pymdownx.caret
- pymdownx.mark
- pymdownx.tilde
- pymdownx.snippets
- md_in_html
plugins:
- include-markdown
- search
- macros
```
test/index.md
```
# h1 with custom variable {{custom_var}}
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
# Other h1
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
```
test/sub/index.md
```
---
title: title with custom variable {{custom_var}}
---
# h1 with custom variable {{custom_var}}
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
# Other h1
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
Some sample text
```
Bug description
Serving the provided project with mkdocs does not expand custom variables in the title bar when scrolling down to the first section of pages:
Maybe It is simply not supported or I'm using it wrong, but I was wondering if it could be fixed ?
I could simply use the text manually without a variable but in our main project we try to put variables everywhere we can as some names are repeated all over the places in various pages level 1 header.
Variables can't be used in the mkdocs nav section (I think) so I don't really want to use the setp of 1 of the following priorities for title page: https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data
And as I describe it here steps 2 and 3 seems to not work with custom variables.
Forwarding from https://github.com/squidfunk/mkdocs-material/issues/5608
Context
environment:
Using the following config file and sample markdown structure:
mkdocs.yml
``` site_name: "Test doc" site_url: "http://localhost" repo_name: test edit_uri: "" docs_dir: "test" site_dir: "test_site" use_directory_urls: false theme: name: 'material' palette: - scheme: default toggle: icon: material/toggle-switch-off-outline name: Dark mode - scheme: slate toggle: icon: material/toggle-switch name: Light mode features: - navigation.instant - navigation.indexes - navigation.top - toc.integrate nav: - Main: - 'index.md' - Sub: - 'sub/index.md' extra: custom_var: 'Custom name' markdown_extensions: - admonition - pymdownx.b64 - pymdownx.highlight - pymdownx.superfences - pymdownx.tabbed: alternate_style: true - pymdownx.mark - pymdownx.details - mdx_truly_sane_lists - attr_list - pymdownx.caret - pymdownx.mark - pymdownx.tilde - pymdownx.snippets - md_in_html plugins: - include-markdown - search - macros ```test/index.md
``` # h1 with custom variable {{custom_var}} Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text # Other h1 Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text ```test/sub/index.md
``` --- title: title with custom variable {{custom_var}} --- # h1 with custom variable {{custom_var}} Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text # Other h1 Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text Some sample text ```Bug description
Serving the provided project with mkdocs does not expand custom variables in the title bar when scrolling down to the first section of pages:
![image](https://github.com/squidfunk/mkdocs-material/assets/76430849/3d85f8b5-8816-409c-b76d-c267ece10ac1)
Maybe It is simply not supported or I'm using it wrong, but I was wondering if it could be fixed ? I could simply use the text manually without a variable but in our main project we try to put variables everywhere we can as some names are repeated all over the places in various pages level 1 header. Variables can't be used in the mkdocs nav section (I think) so I don't really want to use the setp of 1 of the following priorities for title page: https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data And as I describe it here steps 2 and 3 seems to not work with custom variables.
Thanks !
Related links
Reproduction
gh-mkdocs.zip
Steps to reproduce
Browser
Chrome, Firefox