2020-07-21 18:39:27 +02: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 14:46:09 +02:00
|
|
|
|
additional icons][1] with minimal effort.
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
|
|
[1]: #additional-icons
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
### Logo
|
|
|
|
|
|
|
|
|
|
[:octicons-file-code-24: Source][2] ·
|
|
|
|
|
:octicons-milestone-24: Default: `material/library`
|
|
|
|
|
|
|
|
|
|
There're two ways to specify a _logo_: it must be a valid path to [any icon
|
|
|
|
|
bundled with the theme][3], or to a user-provided image located in the `docs`
|
2020-07-23 13:17:50 +02:00
|
|
|
|
folder. Both can be set via `mkdocs.yml`:
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
|
|
=== "Icon"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
|
|
|
|
icon:
|
|
|
|
|
logo: material/library
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
=== "Image"
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
|
|
|
|
logo: assets/logo.png
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/logo.html
|
|
|
|
|
[3]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
|
|
|
|
|
|
|
|
|
|
### Favicon
|
|
|
|
|
|
|
|
|
|
[:octicons-file-code-24: Source][4] ·
|
|
|
|
|
: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 13:17:50 +02:00
|
|
|
|
must be located in the `docs` folder. It can be set via `mkdocs.yml`:
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme:
|
|
|
|
|
favicon: images/favicon.png
|
|
|
|
|
```
|
|
|
|
|
|
2020-09-19 16:19:18 +02:00
|
|
|
|
[4]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html#L74
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
2020-07-22 09:54:17 +02:00
|
|
|
|
### Icons
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
2020-07-23 15:34:43 +02:00
|
|
|
|
[:octicons-file-code-24: Source][3] · [:octicons-workflow-24: Extension][5]
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
2020-07-23 15:34:43 +02:00
|
|
|
|
The [Emoji][5] extension, which is part of [Python Markdown Extensions][6],
|
2020-07-23 13:52:42 +02:00
|
|
|
|
adds the ability to __integrate icons__ in the `*.svg` file format, which are
|
2020-07-24 09:59:16 +02:00
|
|
|
|
inlined when [building your site][7]:
|
2020-07-21 18:39:27 +02: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:
|
|
|
|
|
|
2020-07-23 15:34:43 +02:00
|
|
|
|
* :material-material-design: – [Material Design][8]
|
|
|
|
|
* :fontawesome-brands-font-awesome-flag: – [FontAwesome][9]
|
2020-07-24 09:59:16 +02:00
|
|
|
|
* :octicons-mark-github-16: – [Octicons][10]
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
|
|
If you want to add [additional icons][1], read on.
|
|
|
|
|
|
2020-07-23 15:34:43 +02:00
|
|
|
|
[5]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
|
|
|
|
|
[6]: https://facelessuser.github.io/pymdown-extensions/
|
|
|
|
|
[7]: ../creating-your-site.md#building-your-site
|
|
|
|
|
[8]: https://materialdesignicons.com/
|
|
|
|
|
[9]: https://fontawesome.com/icons?d=gallery&m=free
|
|
|
|
|
[10]: https://octicons.github.com/
|
2020-07-21 18:39:27 +02:00
|
|
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
|
|
### Additional icons
|
|
|
|
|
|
|
|
|
|
[:octicons-file-code-24: Source][3] ·
|
|
|
|
|
:octicons-mortar-board-24: Difficulty: _moderate_
|
|
|
|
|
|
2020-07-26 14:46:09 +02:00
|
|
|
|
In order to add additional icons, [extend the theme][11], and create a folder
|
2020-07-23 15:34:43 +02:00
|
|
|
|
named `.icons` in the [`custom_dir`][12] you want to use for overrides. Next,
|
2020-07-21 18:39:27 +02:00
|
|
|
|
add your `*.svg` icons into a subfolder of the `.icons` folder. Let's say you
|
2020-07-23 15:34:43 +02:00
|
|
|
|
downloaded and unpacked the [Bootstrap][13] 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
|
|
|
|
|
.
|
|
|
|
|
├─ docs/
|
|
|
|
|
│ └─ index.md
|
|
|
|
|
├─ 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.
|
|
|
|
|
|
2020-07-23 15:34:43 +02:00
|
|
|
|
[11]: ../customization.md#extending-the-theme
|
|
|
|
|
[12]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
|
|
|
|
[13]: https://icons.getbootstrap.com/
|