2020-08-30 16:47:50 +02: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
|
|
|
|
|
|
|
|
[:octicons-file-code-24: Source][3] ·
|
2021-02-27 09:14:15 +01:00
|
|
|
:octicons-unlock-24: Feature flag
|
2020-08-30 16:47:50 +02:00
|
|
|
|
2020-11-01 15:43:26 +01:00
|
|
|
When _autohiding_ is enabled, the header is automatically hidden when the
|
2021-02-02 20:51:42 +01:00
|
|
|
user scrolls past a certain threshold, leaving more space for content. Add the
|
2021-01-31 19:23:28 +01:00
|
|
|
following lines to `mkdocs.yml`:
|
2020-08-30 16:47:50 +02:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
theme:
|
|
|
|
features:
|
2020-09-19 15:49:05 +02:00
|
|
|
- header.autohide
|
2020-08-30 16:47:50 +02:00
|
|
|
```
|
|
|
|
|
2020-12-21 17:38:58 +01:00
|
|
|
[3]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_header.scss
|
2020-08-30 16:47:50 +02:00
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
### Announcement bar
|
|
|
|
|
|
|
|
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 15:09:16 +02:00
|
|
|
an announcement bar, [extend the theme][4] and [override the `announce`
|
|
|
|
block][5], which is empty by default:
|
2020-08-30 16:47:50 +02:00
|
|
|
|
|
|
|
``` html
|
|
|
|
{% block announce %}
|
|
|
|
<!-- Add your announcement here, including arbitrary HTML -->
|
|
|
|
{% endblock %}
|
|
|
|
```
|
|
|
|
|
2020-10-04 15:09:16 +02:00
|
|
|
[4]: ../customization.md#extending-the-theme
|
|
|
|
[5]: ../customization.md#overriding-blocks
|