-
Contribution guidelines
I want to suggest an idea and checked that ...
DescriptionI know there are changes to search result summaries coming with #2976, but I'm wondering what I can do now to change the search result summary. Is there a way to override the function that generates or returns these, or some front matter I can use to set a static summary? Use CasesThe data we have in mkdocs is highly structured, and the summaries are very low quality, with most failing to even show the page title. Screenshots / MockupsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Converting to discussion, since this is essentially a question. |
Beta Was this translation helpful? Give feedback.
-
Currently, the search result text is just truncated. You could either customize the mkdocs-material/src/assets/javascripts/utilities/string/index.ts Lines 27 to 47 in f23f738 ... or alter the search result rendering function: mkdocs-material/src/assets/javascripts/templates/search/index.tsx Lines 89 to 91 in f23f738 On a side note, the new search should be ready shortly. Search summaries are really hard to get right for all languages (not just for space-separated, sentence-based ones). I've wanted to improve search summaries for a long, long time, but only had the idea how to do it quite recently. If you really can't wait, you can fork the theme and change the behavior of the sections I linked above 😊 |
Beta Was this translation helpful? Give feedback.
Currently, the search result text is just truncated. You could either customize the
truncate
function:mkdocs-material/src/assets/javascripts/utilities/string/index.ts
Lines 27 to 47 in f23f738