@@ -181,6 +181,33 @@ theme:
181
181
[navigation.expand enabled] : ../assets/screenshots/navigation-expand.png
182
182
[navigation.expand disabled] : ../assets/screenshots/navigation.png
183
183
184
+ # ## Navigation pruning
185
+
186
+ [:octicons-heart-fill-24:{ .mdx-heart } Sponsors only][Insiders]{ .mdx-insiders } ·
187
+ [:octicons-tag-24 : insiders-4.16.0][Insiders] ·
188
+ :octicons-beaker-24 : Experimental
189
+
190
+ When pruning is enabled, only the visible navigation items are included in the
191
+ rendered HTML, __reducing the size of the built site by 33% or more__. Add the
192
+ following lines to `mkdocs.yml` :
193
+
194
+ ` ` ` yaml
195
+ theme:
196
+ features:
197
+ - navigation.prune # (1)!
198
+ ` ` `
199
+
200
+ 1. This feature flag is not compatible with
201
+ [`navigation.expand`][navigation.expand], as navigation expansion requires
202
+ the complete navigation structure.
203
+
204
+ This feature flag is especially useful for documentation sites with 100+ or even
205
+ 1,000+ of pages, as the navigation makes up a significant fraction of the HTML.
206
+ Navigation pruning will replace all expandable sections with links to the first
207
+ page in that section (or the section index page).
208
+
209
+ [navigation.expand] : # navigation-expansion
210
+
184
211
# ## Section index pages
185
212
186
213
[:octicons-tag-24 : 7.3.0][navigation.indexes support] ·
@@ -194,9 +221,12 @@ following lines to `mkdocs.yml`:
194
221
` ` ` yaml
195
222
theme:
196
223
features:
197
- - navigation.indexes
224
+ - navigation.indexes # (1)!
198
225
` ` `
199
226
227
+ 1. This feature flag is not compatible with [`toc.integrate`][toc.integrate],
228
+ as sections cannot host the table of contents due to missing space.
229
+
200
230
=== ":octicons-check-circle-fill-16 : Enabled"
201
231
202
232
[![navigation.indexes enabled]][navigation.indexes enabled]
218
248
- Page n: section/page-n.md
219
249
` ` `
220
250
221
- This feature flag is not compatible with [`toc.integrate`][toc.integrate].
222
-
223
251
[navigation.indexes support] : https://github.com/squidfunk/mkdocs-material/releases/tag/7.3.0
224
252
[navigation.indexes enabled] : ../assets/screenshots/navigation-index-on.png
225
253
[navigation.indexes disabled] : ../assets/screenshots/navigation-index-off.png
@@ -257,9 +285,13 @@ to `mkdocs.yml`:
257
285
` ` ` yaml
258
286
theme:
259
287
features:
260
- - toc.integrate
288
+ - toc.integrate # (1)!
261
289
` ` `
262
290
291
+ 1. This feature flag is not compatible with
292
+ [`navigation.indexes`][navigation.indexes], as sections cannot host the
293
+ table of contents due to missing space.
294
+
263
295
=== ":octicons-check-circle-fill-16 : Enabled"
264
296
265
297
[![toc.integrate enabled]][toc.integrate enabled]
@@ -268,9 +300,6 @@ theme:
268
300
269
301
[![toc.integrate disabled]][toc.integrate disabled]
270
302
271
- This feature flag is not compatible with [`navigation.indexes`]
272
- [navigation.indexes].
273
-
274
303
[table of contents] : extensions/python-markdown.md#table-of-contents
275
304
[toc.integrate support] : https://github.com/squidfunk/mkdocs-material/releases/tag/7.3.0
276
305
[toc.integrate enabled] : ../assets/screenshots/toc-integrate.png
0 commit comments