简体   繁体   English

GatsbyJs,文件夹内的页面

[英]GatsbyJs, page inside folder

i read that gatsby create the proper page if you save items in the pages folder.如果您将项目保存在 pages 文件夹中,我读到 gatsby 会创建正确的页面。

Ex---->前---->

src/
  pages/
    Home.tsx
    LandingPage.tsx

I can reach the page, for example at http://localhost:8000/LandingPage我可以访问该页面,例如http://localhost:8000/LandingPage

but what can i do if I have the following folder structure?但是如果我有以下文件夹结构,我该怎么办?

src/
  pages/
    Home/
      index.tsx
    LandingPage/
      index.tsx

If you have the following folder structure:如果您具有以下文件夹结构:

src/
  pages/
    Home/
      index.tsx
    LandingPage/
      index.tsx

You will get the following paths:您将获得以下路径:

http://localhost:8000/Home http://localhost:8000/Home

http://localhost:8000/LandingPage http://localhost:8000/LandingPage

You don't have to set anything else Gatsby figures it out for you by default.默认情况下,您不必设置任何其他 Gatsby 为您计算的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GatsbyJS:是否可以在layouts文件夹中创建的组件内部进行查询? - GatsbyJS: is it possible to query inside a component created in the layouts folder? 如何根据导入组件的页面更改 GatsbyJS 组件内元素的背景颜色? - How to change the background-color of an element that is inside a GatsbyJS component, based on the page where I import the component? Gatsbyjs 页面生成 | 最佳实践 - Gatsbyjs Page generation | Best practices 在 GatsbyJS/GraphQL 中组合页面查询 - combining page queries in GatsbyJS/GraphQL 在Gatsbyjs中分配模板,而不考虑“相同文件夹”范式 - Assigning templates in Gatsbyjs regardless of “same folder” paradigm GatsbyJS:StatiscQuery 从当前页面传入数据 - GatsbyJS: StatiscQuery pass in data from current page Gatsbyjs - 将静态页面的位置定义为“页面”文件夹以外的其他内容 - Gatsbyjs - Define Location of Static Pages as Something Other than the 'pages' folder GraphQL和GatsbyJS:我的查询在布局文件夹中不起作用 - GraphQL and GatsbyJS: my query isn't working in layouts folder Graphiql界面中的GatsbyJs gaphql查询文件夹/post.md - GatsbyJs gaphql query folder/post.md in graphiql interface GatsbyJS 网站非页面组件中的 GraphQL 查询投诉 - GraphQL query complaints in non-page component for GatsbyJS website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM