-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Question: Exclude from Local Search and display Frontmatter data #2344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, I am currently migrating a doc website from Vuepress to Vitepress. I would like to exclude certain content from the search results but I can't find a way to do it with Vitepress. This ticket seems to indicate that it could be an improvement to Vitepress. Is this a possible development? I have time to work on this subject. I can contribute. Is there a particular direction you would like to take on this subject? Which API expose? I imagine 2 ways to exclude content from search results.
// .vitepress/config
export default defineConfig({
themeConfig: {
search: {
provider: 'local',
options: {
isSearchable (pageData) {
return !pageData.startsWith('/excluded-folder')
},
},
},
})
---
search: false
---
<!-- excluded-folder/index.md -->
# my content excluded from search results What do you think ? |
Yeah contributions are welcome. Make the API something like this: interface LocalSearchOptions {
exclude: (pageData: PageData) => boolean
} So that function can be: return pageData.relativePath.startsWith('/excluded-folder') || pageData.frontmatter.search === false |
The new Local Search is great! I just have a few questions:
/secret/
folder that I would like to exclude all subpages from search results, how would I do that?The text was updated successfully, but these errors were encountered: