2020-07-21 19:39:27 +03:00
|
|
|
|
---
|
|
|
|
|
template: overrides/main.html
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Changing the logo and icons
|
|
|
|
|
|
|
|
|
|
When installing Material for MkDocs, you immediately get access to _over 7.000
|
|
|
|
|
icons_ ready to be used for customization of specific parts of the theme and/or
|
|
|
|
|
when writing your documentation in Markdown. Not enough? You can also [add
|
2020-07-26 15:46:09 +03:00
|
|
|
|
additional icons][1] with minimal effort.
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
[1]: #additional-icons
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
### Logo
|
|
|
|
|
|
|
|
|
|
[:octicons-file-code-24: Source][2] ·
|
2021-03-07 17:40:20 +03:00
|
|
|
|
:octicons-milestone-24: Default: [`material/library`][3]
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
The _logo_ can be changed to a user-provided image (any type, incl. `*.png` and
|
|
|
|
|
`*.svg`) located in the `docs` folder, or to any icon bundled with the theme.
|
|
|
|
|
Add the following lines to `mkdocs.yml`:
|
2021-03-02 00:54:19 +03:00
|
|
|
|
|
|
|
|
|
=== "Image"
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
2021-03-02 00:54:19 +03:00
|
|
|
|
logo: assets/logo.png
|
2020-07-21 19:39:27 +03:00
|
|
|
|
```
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
=== "Icon, bundled"
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
2021-03-02 00:54:19 +03:00
|
|
|
|
icon:
|
|
|
|
|
logo: material/library
|
2020-07-21 19:39:27 +03:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/logo.html
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[3]: https://github.com/squidfunk/mkdocs-material/blob/master/material/.icons/material/library.svg
|
|
|
|
|
[4]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
2021-03-14 16:09:13 +03: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 19:39:27 +03:00
|
|
|
|
### Favicon
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[:octicons-file-code-24: Source][5] ·
|
2020-07-21 19:39:27 +03:00
|
|
|
|
:octicons-milestone-24: Default: `assets/images/favicon.png`
|
|
|
|
|
|
|
|
|
|
The _favicon_ can be changed to a path pointing to a user-provided image, which
|
2020-07-23 14:17:50 +03:00
|
|
|
|
must be located in the `docs` folder. It can be set via `mkdocs.yml`:
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
|
|
|
|
favicon: images/favicon.png
|
|
|
|
|
```
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[5]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
2020-07-22 10:54:17 +03:00
|
|
|
|
### Icons
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[:octicons-file-code-24: Source][4] · [:octicons-workflow-24: Extension][6]
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
The [Emoji][6] extension, which is part of [Python Markdown Extensions][7],
|
2020-07-23 14:52:42 +03:00
|
|
|
|
adds the ability to __integrate icons__ in the `*.svg` file format, which are
|
2021-03-07 17:40:20 +03:00
|
|
|
|
inlined when [building your site][8]:
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- pymdownx.emoji:
|
|
|
|
|
emoji_index: !!python/name:materialx.emoji.twemoji
|
|
|
|
|
emoji_generator: !!python/name:materialx.emoji.to_svg
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The following icon sets are bundled with Material for MkDocs:
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
- :material-material-design: – [Material Design][9]
|
|
|
|
|
- :fontawesome-brands-font-awesome-flag: – [FontAwesome][10]
|
|
|
|
|
- :octicons-mark-github-16: – [Octicons][11]
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
If you want to add [additional icons][1], read on.
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[6]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
|
|
|
|
|
[7]: https://facelessuser.github.io/pymdown-extensions/
|
|
|
|
|
[8]: ../creating-your-site.md#building-your-site
|
|
|
|
|
[9]: https://materialdesignicons.com/
|
|
|
|
|
[10]: https://fontawesome.com/icons?d=gallery&m=free
|
|
|
|
|
[11]: https://octicons.github.com/
|
2020-07-21 19:39:27 +03:00
|
|
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
|
|
### Additional icons
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[:octicons-file-code-24: Source][4] ·
|
2020-07-21 19:39:27 +03:00
|
|
|
|
:octicons-mortar-board-24: Difficulty: _moderate_
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
In order to add additional icons, [extend the theme][12], and create a folder
|
|
|
|
|
named `.icons` in the [`custom_dir`][13] you want to use for overrides. Next,
|
2020-07-21 19:39:27 +03:00
|
|
|
|
add your `*.svg` icons into a subfolder of the `.icons` folder. Let's say you
|
2021-03-07 17:40:20 +03:00
|
|
|
|
downloaded and unpacked the [Bootstrap][14] icon set, and want to add it to
|
2020-07-21 19:39:27 +03: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
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
You should now be able to use the :fontawesome-brands-bootstrap: Bootstrap
|
|
|
|
|
icons.
|
|
|
|
|
|
2021-03-07 17:40:20 +03:00
|
|
|
|
[12]: ../customization.md#extending-the-theme
|
|
|
|
|
[13]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
|
|
|
|
[14]: https://icons.getbootstrap.com/
|