2022-02-27 15:08:31 +01:00
|
|
|
|
# Building for offline usage
|
|
|
|
|
|
|
|
|
|
If you want to ship your documentation together with your product, MkDocs has
|
|
|
|
|
you covered – with support from themes, [MkDocs] allows for building
|
2023-01-21 17:03:55 +01:00
|
|
|
|
offline-capable documentation. Notably, Material for MkDocs offers offline
|
2022-02-27 15:08:31 +01:00
|
|
|
|
support for many of its features.
|
|
|
|
|
|
|
|
|
|
[MkDocs]: https://www.mkdocs.org
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
### Built-in offline plugin
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
<!-- md:version 9.0.0 -->
|
|
|
|
|
<!-- md:plugin [offline] – built-in -->
|
2022-02-27 15:08:31 +01:00
|
|
|
|
|
|
|
|
|
The built-in offline plugin makes sure that the [site search] works when you
|
|
|
|
|
distribute the contents of your [site directory] as a download. Simply add
|
|
|
|
|
the following lines to `mkdocs.yml`:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
plugins:
|
2022-10-01 16:48:03 +02:00
|
|
|
|
- offline
|
2022-02-27 15:08:31 +01:00
|
|
|
|
```
|
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
For a list of all settings, please consult the [plugin documentation].
|
2022-02-27 15:08:31 +01:00
|
|
|
|
|
2023-09-14 19:09:18 +02:00
|
|
|
|
[offline]: ../plugins/offline.md
|
|
|
|
|
[plugin documentation]: ../plugins/offline.md
|
2022-02-27 15:08:31 +01:00
|
|
|
|
|
|
|
|
|
!!! tip "Automatically bundle all external assets"
|
|
|
|
|
|
2023-01-01 17:44:37 +01:00
|
|
|
|
The [built-in privacy plugin] makes it easy to use external assets
|
2022-02-27 15:08:31 +01:00
|
|
|
|
while building documentation for offline usage, as it will automatically
|
|
|
|
|
download all external assets to distribute them with your documentation.
|
|
|
|
|
|
|
|
|
|
[site search]: setting-up-site-search.md
|
|
|
|
|
[site directory]: https://www.mkdocs.org/user-guide/configuration/#site_dir
|
2023-09-15 09:25:50 +02:00
|
|
|
|
[built-in privacy plugin]:../plugins/privacy.md
|
2022-02-27 15:08:31 +01:00
|
|
|
|
|
|
|
|
|
#### Limitations
|
|
|
|
|
|
|
|
|
|
Material for MkDocs offers many interactive features, some of which will not
|
|
|
|
|
work from the file system due to the restrictions of modern browsers: all
|
|
|
|
|
features that use the `fetch` API will error.
|
|
|
|
|
|
|
|
|
|
Thus, when building for offline usage, make sure to disable the following
|
|
|
|
|
configuration settings: [instant loading], [site analytics], [git repository],
|
|
|
|
|
[versioning] and [comment systems].
|
|
|
|
|
|
|
|
|
|
[Instant loading]: setting-up-navigation.md#instant-loading
|
|
|
|
|
[Site analytics]: setting-up-site-analytics.md
|
|
|
|
|
[Versioning]: setting-up-versioning.md
|
|
|
|
|
[Git repository]: adding-a-git-repository.md
|
|
|
|
|
[Comment systems]: adding-a-comment-system.md
|