Exclude pages from search #8230
-
We're using imports ( If using the search however - these pages often show up as the first result - which is clearly not what we want (it's pages for reusability which shouldn't be navigated to directly). Using the search.exclude front-matter doesn't work for imported files - as it'll render like this: (with the top section coming from the parent, and the --- and the code block coming from the imported file). Ideally, i'd like to use something like the following to exclude that whole directory - but from the docs - i didn't find this being possible? - search.exclude:
- commands/**
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @xmatthias, Either move the snippets outside docs and change the Or maybe I misunderstood, and you're looking to exclude sections that are inserted via the snippets extension, then maybe this part of the documentation will help you: |
Beta Was this translation helpful? Give feedback.
Hello @xmatthias,
your snippets shouldn't be inside of your
docs
directory, the Snippets extension copies the text files as is, without support for MkDocsmeta
header. MkDocs creates a Page object from every Markdown file insidedocs
, and themeta
only works in that case.Either move the snippets outside docs and change the
base_path
of the Snippets extension, or use theexclude_docs
option to turn off the Page object creation and remove thesearch exclude
header.Or maybe I misunderstood, and you're looking to exclude sections that are inserted via the snippets extension, then maybe this part of the documentation will help you: