Coder Social home page Coder Social logo

Comments (2)

prototypa avatar prototypa commented on August 27, 2024

Hi @houmedfa

It's good to know that you find AstroWind useful. It is still a work in progress, any suggestion or idea you have, contact us.

The error that is shown to you is because you are defining the route like this [...organizations]. According to the Astro documentation, routes defined with [] are dynamic and require you to implement the getStaticPaths function.

My doubt is that I don't know if you need to create only one page with /organizations, or a list of dynamic pages inside the organizations folder

  1. To create the '/organizations' url, if you only want to create that route with a simple page you can do either of the two variants:

A

/
│   ├── pages/
│   |   ├── ...
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
+   |   ├── organizations/
+   |   |   └── index.astro
│   |   ├── index.astro
|   |   ├── 404.astro
|   |   └-- rss.xml.js
└── ...

B

/
│   ├── pages/
│   |   ├── ...
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
+   |   ├── organizations.astro
│   |   ├── index.astro
|   |   ├── 404.astro
|   |   └-- rss.xml.js
└── ...

2. On the other hand, if you want to create a list of pages inside /organizations route, then the folder structure for the paths should be different.
/
│   ├── pages/
│   |   ├── ...
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
+   |   ├── organizations/
+   |   |   ├── organization1.astro
+   |   |   ├── organization2.astro
+   |   |   └── index.astro
│   |   ├── index.astro
|   |   ├── 404.astro
|   |   └-- rss.xml.js
└── ...

3. And if you want to create a list of **dynamic pages** inside /organizations route, then the folder structure for the paths should be different.
/
│   ├── pages/
│   |   ├── ...
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
+   |   ├── organizations/
+   |   |   ├── [...pages].astro
+   |   |   └──[slug].astro
│   |   ├── index.astro
|   |   ├── 404.astro
|   |   └-- rss.xml.js
└── ...

And you should also implement a getStaticPaths function inside each of those dynamic paths [slug].astro, [...page].astro

https://docs.astro.build/en/core-concepts/routing/#dynamic-routes

from astrowind.

houmedfa avatar houmedfa commented on August 27, 2024

thank you for your clean and helpful anwser.

from astrowind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.