You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating a pages using rest parameters the page will fail with a 404 when running in the dev server. However, when building the project the page is correctly being generated (and works fine with preview).
Structure
/pages
/pages/subfolder/[...slug].astro
The page /pages/subfolder/[...slug].astro is generating output pages in multiple sub-levels. The date of the content for the page is being used to construct the path. For instance /subfolder/2021/09/05/name-of-page/index.html.
When running astro build the expected files will be created and everything works. However, when running the dev server all generated pages will fail with a 404.
getStaticPaths
The paths are generated to create subfolders (as seen above) using the year, month and date in this case.
exportasyncfunctiongetStaticPaths(){constallPosts=awaitgetAllPosts();returnallPosts.map((post)=>{constfullSlug=generateSlug(post._createdAt,post.slug.current);// fullSlug example -> «/2021/09/05/the-name-of-the-post»return{params: {slug: fullSlug},props: { post }};});}
Steps to Reproduce
npm init astro (using Typescript)
Create the structure described above
Run the dev server «astro dev»
Visit one of the dynamic/generated pages
The page is not found.
Link to Minimal Reproducible Example (Optional)
No response
The text was updated successfully, but these errors were encountered:
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
When generating a pages using rest parameters the page will fail with a 404 when running in the dev server. However, when building the project the page is correctly being generated (and works fine with preview).
Structure
/pages
/pages/subfolder/[...slug].astro
The page
/pages/subfolder/[...slug].astro
is generating output pages in multiple sub-levels. The date of the content for the page is being used to construct the path. For instance/subfolder/2021/09/05/name-of-page/index.html
.When running
astro build
the expected files will be created and everything works. However, when running the dev server all generated pages will fail with a 404.getStaticPaths
The paths are generated to create subfolders (as seen above) using the year, month and date in this case.
Steps to Reproduce
npm init astro
(using Typescript)Link to Minimal Reproducible Example (Optional)
No response
The text was updated successfully, but these errors were encountered: