@@ -261,6 +261,29 @@ For setup instructions, refer to the [official documentation][18].
261261 system, you will also want to set `use_directory_urls : false` in
262262 ` mkdocs.yml` to make page links function correctly.
263263
264+ # # Usage
265+
266+ # ## Boosting a page
267+
268+ [:octicons-file-code-24 : Source][8] ·
269+ :octicons-note-24 : Metadata ·
270+ [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][8]{ .mdx-insiders }
271+
272+ In order to give specific pages a higher relevance in search, [lunr][4] supports
273+ page-specific boosts, which can be defined for each page by leveraging the
274+ [Metadata][19] extension :
275+
276+ ` ` ` yaml
277+ ---
278+ search:
279+ boost: 100
280+ ---
281+
282+ ...
283+ ` ` `
284+
285+ [19] : ../../reference/meta-tags/#metadata
286+
264287# # Customization
265288
266289The search implementation of Material for MkDocs is probably its most
@@ -273,12 +296,12 @@ your needs.
273296
274297# ## Query transformation
275298
276- [:octicons-file-code-24 : Source][19 ] ·
299+ [:octicons-file-code-24 : Source][20 ] ·
277300:octicons-mortar-board-24 : Difficulty: _easy_
278301
279302When a user enters a query into the search box, the query is pre-processed
280303before it is submitted to the search index. Material for MkDocs will apply the
281- following transformations, which can be customized by [extending the theme][20 ] :
304+ following transformations, which can be customized by [extending the theme][21 ] :
282305
283306` ` ` ts
284307/**
@@ -318,7 +341,7 @@ export function defaultTransform(query: string): string {
318341If you want to switch to the default behavior of the ` mkdocs ` and ` readthedocs `
319342themes, both of which don't transform the query prior to submission, or
320343customize the ` transform ` function, you can do this by [ overriding the
321- ` config ` block] [ 21 ] :
344+ ` config ` block] [ 22 ] :
322345
323346``` html
324347{% block config %}
@@ -336,19 +359,19 @@ customize the `transform` function, you can do this by [overriding the
336359The ` transform ` function will receive the query string as entered by the user
337360and must return the processed query string to be submitted to the search index.
338361
339- [ 19 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
340- [ 20 ] : ../customization.md#extending-the-theme
341- [ 21 ] : ../customization.md#overriding-blocks-recommended
362+ [ 20 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
363+ [ 21 ] : ../customization.md#extending-the-theme
364+ [ 22 ] : ../customization.md#overriding-blocks-recommended
342365
343366### Custom search
344367
345- [ :octicons-file-code-24: Source] [ 22 ] ·
368+ [ :octicons-file-code-24: Source] [ 23 ] ·
346369:octicons-mortar-board-24: Difficulty: _ challenging_
347370
348- Material for MkDocs implements search as part of a [ web worker] [ 23 ] . If you
371+ Material for MkDocs implements search as part of a [ web worker] [ 24 ] . If you
349372want to switch the web worker with your own implementation, e.g. to submit
350- search to an external service, you can add a custom JavaScript file to the ` docs `
351- directory and [ override the ` config ` block] [ 21 ] :
373+ search to an external service, you can add a custom JavaScript file to the
374+ ` docs ` directory and [ override the ` config ` block] [ 21 ] :
352375
353376``` html
354377{% block config %}
@@ -366,8 +389,8 @@ format using _discriminated unions_, i.e. through the `type` property of the
366389message. See the following interface definitions to learn about the message
367390formats:
368391
369- - [ :octicons-file-code-24: ` SearchMessage ` ] [ 24 ]
370- - [ :octicons-file-code-24: ` SearchIndex ` and ` SearchResult ` ] [ 25 ]
392+ - [ :octicons-file-code-24: ` SearchMessage ` ] [ 25 ]
393+ - [ :octicons-file-code-24: ` SearchIndex ` and ` SearchResult ` ] [ 26 ]
371394
372395The sequence and direction of messages is rather intuitive:
373396
@@ -376,7 +399,7 @@ The sequence and direction of messages is rather intuitive:
376399- :octicons-arrow-right-24: ` SearchQueryMessage `
377400- :octicons-arrow-left-24: ` SearchResultMessage `
378401
379- [ 22 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
380- [ 23 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
381- [ 24 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
382- [ 25 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
402+ [ 23 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
403+ [ 24 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
404+ [ 25 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
405+ [ 26 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
0 commit comments