2020-08-30 17:47:50 +03:00
|
|
|
---
|
|
|
|
template: overrides/main.html
|
|
|
|
---
|
|
|
|
|
|
|
|
# Setting up the header
|
|
|
|
|
|
|
|
Material for MkDocs' header can be customized to show an announcement bar that
|
|
|
|
disappears upon scrolling, and provides some options for further configuration.
|
|
|
|
It also includes the [search bar][1] and a place to display your project's
|
|
|
|
[git repository][2], as explained in those dedicated guides.
|
|
|
|
|
|
|
|
[1]: setting-up-site-search.md
|
|
|
|
[2]: adding-a-git-repository.md
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
### Automatic hiding
|
|
|
|
|
2021-10-03 21:28:52 +03:00
|
|
|
:octicons-unlock-24: Feature flag ·
|
2021-10-10 18:39:53 +03:00
|
|
|
[:octicons-tag-24: 6.2.0][Automatic hiding support]
|
2020-08-30 17:47:50 +03:00
|
|
|
|
2020-11-01 17:43:26 +03:00
|
|
|
When _autohiding_ is enabled, the header is automatically hidden when the
|
2021-02-02 22:51:42 +03:00
|
|
|
user scrolls past a certain threshold, leaving more space for content. Add the
|
2021-01-31 21:23:28 +03:00
|
|
|
following lines to `mkdocs.yml`:
|
2020-08-30 17:47:50 +03:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
theme:
|
|
|
|
features:
|
2020-09-19 16:49:05 +03:00
|
|
|
- header.autohide
|
2020-08-30 17:47:50 +03:00
|
|
|
```
|
|
|
|
|
2021-10-03 21:28:52 +03:00
|
|
|
[Automatic hiding support]: https://github.com/squidfunk/mkdocs-material/releases/tag/6.2.0
|
2020-08-30 17:47:50 +03:00
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
### Announcement bar
|
|
|
|
|
2021-10-03 21:28:52 +03:00
|
|
|
:octicons-file-symlink-file-24: Customization ·
|
2021-10-10 18:39:53 +03:00
|
|
|
[:octicons-tag-24: 5.0.0][Announcement bar support]
|
2021-10-03 21:28:52 +03:00
|
|
|
|
2020-08-30 17:47:50 +03:00
|
|
|
Material for MkDocs includes an announcement bar, which is the perfect place to
|
|
|
|
display project news or other important information to the user. When the user
|
|
|
|
scrolls past the header, the bar will automatically disappear. In order to add
|
2020-10-04 16:09:16 +03:00
|
|
|
an announcement bar, [extend the theme][4] and [override the `announce`
|
|
|
|
block][5], which is empty by default:
|
2020-08-30 17:47:50 +03:00
|
|
|
|
|
|
|
``` html
|
2021-09-12 11:15:21 +03:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
2020-08-30 17:47:50 +03:00
|
|
|
{% block announce %}
|
|
|
|
<!-- Add your announcement here, including arbitrary HTML -->
|
|
|
|
{% endblock %}
|
|
|
|
```
|
|
|
|
|
2021-10-03 21:28:52 +03:00
|
|
|
[Announcement bar support]: https://github.com/squidfunk/mkdocs-material/releases/tag/6.2.0
|
|
|
|
|
2020-10-04 16:09:16 +03:00
|
|
|
[4]: ../customization.md#extending-the-theme
|
2021-05-01 21:26:54 +03:00
|
|
|
[5]: ../customization.md#overriding-blocks-recommended
|