## 事象 `mkdocs serve` でビルドを含むホットリロードが遅い。2秒くらいかかる。 ### 環境 | 対象 | バージョン | | ----------------------------- | ----------- | | [[Ubuntu]] | 24.04.1 LTS | | [[Neovim]] | 0.10.3 | | [[MkDocs]] | 1.6.1 | | [[Material for MkDocs]] | 9.6.5 | | [[mkdocs-git-authors-plugin]] | 0.9.2 | ### 設定 [[mkdocs-git-authors-plugin]] の部分のみ。 ```yaml - git-authors: strict: false show_email_address: false ``` ## 原因 リビルドのたびに[[Git]]情報を多量に読み込んでいるため。ノートの量に比例して遅くなっていそう。 ## 解決方法 デプロイ時のビルド以外では、[[mkdocs-git-authors-plugin]]を無効化する。コマンド実行時の環境変数で制御できるよう `mkdocs.yml` に `enabled` プロパティを追加する。 リリースのときだけ `RELEASE=true` を指定してビルドするのであれば以下のように書く。 ```yaml - git-authors: enabled: !ENV [RELEASE, False] strict: false show_email_address: false ``` ## 参考 - [Options \- git\-authors Plugin](https://timvink.github.io/mkdocs-git-authors-plugin/options.html#enabled)