Skip to content
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

博客会展示未经允许的内容 #20

Closed
charleschetty opened this issue Nov 11, 2022 · 3 comments
Closed

博客会展示未经允许的内容 #20

charleschetty opened this issue Nov 11, 2022 · 3 comments

Comments

@charleschetty
Copy link

如题,我自己测试时候会展示node_modules中的md文件

demo里面会显示readme文件:https://visionary-sunflower-dc7ae3.netlify.app/readme.html

@clark-cui
Copy link
Owner

clark-cui commented Nov 12, 2022

这个是正常行为,你不去主动访问这个node_modules地址,vitepress就不会就打包他的服务。目的是为了保留开发环境下多目录的服务启动。对于这种静态生成器,在生产环境都是构建产物,所以也不会有node_modules目录的情况。
如果你想要开发环境只起指定目录的服务,可以在package.json里scripts字段 dev的command里加上指定目录即可,例如我这里的是posts目录,命令就改为vitepress dev posts

@charleschetty
Copy link
Author

感谢回答,我本来是打算加一个搜索插件,结果搜索结果显示了node_modules中的内容,那看来是我配置的问题,感谢。

@clark-cui
Copy link
Owner

不客气,我这个好久没维护了。之前vitepress默认的模板很丑,所以我自己写了个。现在vitepress默认的主题就不错,推荐直接用vitepress官网那个模板吧,搜索的话可以接入algolia,他有自己写好的包,微调下样式就行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants