【问题标题】:How to use Gatsby file system route API for the frontpage如何在首页使用 Gatsby 文件系统路由 API
【发布时间】:2021-07-07 08:01:43
【问题描述】:

我正在使用 Gatsbys 文件系统路由 API 创建动态页面,除了第 1 个问题外,它运行良好。 我不知道如何使它适用于首页(https://localhost:8000/)

我将页面文件创建为 pages/{Node.url}.tsx

我看到它正在工作 e。 G。对于 http://localhost:8000/news, http://localhost:8000/toc, ... 但是对于首页,URL 是 http://localhost:8000/.tsx/ 而不是 http://localhost:8000/

的预期

任何关于如何解决此问题的想法将不胜感激:)

【问题讨论】:

    标签: gatsby


    【解决方案1】:

    我认为您需要在/pages 文件夹下创建一个index.tsx,Gatsby 会将其作为主页 (/),创建结果 URL 为 http://localhost:8000/

    【讨论】:

      猜你喜欢
      • 2021-10-12
      • 2020-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-21
      • 2021-04-23
      • 1970-01-01
      • 2016-06-29
      相关资源
      最近更新 更多