什么是在Sveltekit项目中添加robots.txt文件的最佳方法?
官方 sveltekit docs 关于SEO主题端点。我找不到与robots.txt文件相关的其他文档,这些文档可用于引用Web Crawlers和SEO优化的站点地图。
我也看了其他论坛,但找不到解决方案。我创建了我的机器人。当我在nazar-design.com/robots.txt
上搜索项目文件时,我将获得404个错误消息。
知道如何解决这个问题?
The official SvelteKit docs on the topic of SEO, which mentions that a sitemap can be dynamically created using an endpoint. I could not find other documentation related to the robots.txt file, that can be used to reference the sitemap for web crawlers and SEO optimization.
I looked on other forums as well but could not find a solution. I created my robots.txt and included it at the root of my project /
and in /src
as well. When I search for the project file on nazar-design.com/robots.txt
I am served with a 404 error message.
Any idea how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将文件放在
kit.files.sets.sets
配置(默认情况下为/static
文件夹)中所指定的目录中。在您的情况下,将文件放置在
/static/robots.txt
将产生所需的nazar-design.com/robots.txt
url。You can place files in the directory named in your
kit.files.assets
configuration (which is the/static
folder by default) to be served to users as-is.In your case, placing the file at
/static/robots.txt
would yield the desirednazar-design.com/robots.txt
URL.