Replies: 2 comments 5 replies
-
Do you want a frontmatter to control the page not to be indexed? VitePress is built using SSG. Each generated page contains duplicate content regardless of NavBar, sideBar, etc., which will cause duplication in the generated index. When the keywords you search for are in sideBar or NavBar, the search results will appear. All pages will appear. This VPContent component only contains the article content generated by markdown, so I added this tag to it to prevent duplicate parts on different pages from being generated and retrieved. If you just want the article not to appear in search results, you can set ---
publish: false
--- Or add a custom |
Beta Was this translation helpful? Give feedback.
-
I read the documentation and there should be at least 3 ways to achieve it. I will study it to see which one is more suitable for VitePress, which is simpler to implement and has better compatibility.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for this plugin. I have questions regarding the way data-pagefind-body is handled, and how we can target specific pages via frontmatter.
Within the index.mjs / index.js files;
node_modules\vitepress-plugin-pagefind\dist\index.mjs
I note this snippet;
This places data-pagefind-body in all VitePress pages during the build process allowing for each of these pages to be searched, as per PageFind docs; https://pagefind.app/docs/indexing/#limiting-what-sections-of-a-page-are-indexed
I'm thinking that it would be useful to index project pages based on VitePress frontmatter content. Perhaps for example, only index pages;
This would result in any page containing
"data-pagefind-body": true
to be indexed, and all other pages ignored during the index build step.I figured I'd ask about this before getting to involved in editing the index.mjs file.
Beta Was this translation helpful? Give feedback.
All reactions