什么是在Sveltekit项目中添加robots.txt文件的最佳方法?

发布于 2025-01-27 19:22:34 字数 298 浏览 3 评论 0原文

官方 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱*していゐ 2025-02-03 19:22:34

您可以将文件放在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 desired nazar-design.com/robots.txt URL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文