2020-07-21 18:39:27 +02:00
|
|
|
---
|
|
|
|
template: overrides/main.html
|
|
|
|
---
|
|
|
|
|
|
|
|
# Changing the logo and icons
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
When installing Material for MkDocs, you immediately get access to _over 8.000
|
2020-07-21 18:39:27 +02:00
|
|
|
icons_ ready to be used for customization of specific parts of the theme and/or
|
2021-10-10 17:39:53 +02:00
|
|
|
when writing your documentation in Markdown. Not enough? You can also add
|
|
|
|
[additional icons] with minimal effort.
|
2020-07-21 18:39:27 +02:00
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[additional icons]: #additional-icons
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
### Logo
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[:octicons-tag-24: 0.1.0][logo support] ·
|
|
|
|
:octicons-milestone-24: Default: [`material/library`][logo default]
|
2020-07-21 18:39:27 +02:00
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
The logo can be changed to a user-provided image (any type, incl. `*.png` and
|
2021-03-07 15:40:20 +01:00
|
|
|
`*.svg`) located in the `docs` folder, or to any icon bundled with the theme.
|
|
|
|
Add the following lines to `mkdocs.yml`:
|
2021-03-01 22:54:19 +01:00
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
=== ":octicons-image-16: Image"
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
theme:
|
2021-03-01 22:54:19 +01:00
|
|
|
logo: assets/logo.png
|
2020-07-21 18:39:27 +02:00
|
|
|
```
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
=== ":octicons-package-16: Icon, bundled"
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
theme:
|
2021-03-01 22:54:19 +01:00
|
|
|
icon:
|
|
|
|
logo: material/library
|
2020-07-21 18:39:27 +02:00
|
|
|
```
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[logo support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
|
|
|
[logo default]: https://github.com/squidfunk/mkdocs-material/blob/master/material/.icons/material/library.svg
|
2020-07-21 18:39:27 +02:00
|
|
|
|
2021-03-14 14:09:13 +01:00
|
|
|
Normally, the logo in the header and sidebar links to the homepage of the
|
|
|
|
documentation, which is the same as `site_url`. This behavior can be changed
|
|
|
|
with the following configuration:
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
extra:
|
|
|
|
homepage: https://example.com
|
|
|
|
```
|
|
|
|
|
2020-07-21 18:39:27 +02:00
|
|
|
### Favicon
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[:octicons-tag-24: 0.1.0][favicon support] ·
|
|
|
|
:octicons-milestone-24: Default: [`assets/images/favicon.png`][favicon default]
|
2020-07-21 18:39:27 +02:00
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
The favicon can be changed to a path pointing to a user-provided image, which
|
|
|
|
must be located in the `docs` folder. Add the following lines to `mkdocs.yml`:
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
theme:
|
|
|
|
favicon: images/favicon.png
|
|
|
|
```
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[favicon support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
|
|
|
[favicon default]: https://github.com/squidfunk/mkdocs-material/blob/master/material/assets/images/favicon.png
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
### Additional icons
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
In order to use custom icons, [extend the theme] and create a new folder named
|
|
|
|
`.icons` in the [`custom_dir`][custom_dir] you want to use for overrides.
|
|
|
|
Next, add your `*.svg` icons into a subfolder of the `.icons` folder. Let's say
|
|
|
|
you downloaded and unpacked the [Bootstrap] icon set, and want to add it to
|
2020-07-21 18:39:27 +02:00
|
|
|
your project documentation. The structure of your project should look like this:
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
.
|
|
|
|
├─ overrides/
|
|
|
|
│ └─ .icons/
|
|
|
|
│ └─ bootstrap/
|
|
|
|
│ └─ *.svg
|
|
|
|
└─ mkdocs.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, add the following lines to `mkdocs.yml`:
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
markdown_extensions:
|
|
|
|
- pymdownx.emoji:
|
|
|
|
emoji_index: !!python/name:materialx.emoji.twemoji
|
|
|
|
emoji_generator: !!python/name:materialx.emoji.to_svg
|
|
|
|
options:
|
|
|
|
custom_icons:
|
|
|
|
- overrides/.icons
|
|
|
|
```
|
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
You can now use all :fontawesome-brands-bootstrap: Bootstrap icons.
|
2020-07-21 18:39:27 +02:00
|
|
|
|
2021-10-10 17:39:53 +02:00
|
|
|
[extend the theme]: ../customization.md#extending-the-theme
|
|
|
|
[custom_dir]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
|
|
|
[Bootstrap]: https://icons.getbootstrap.com/
|