Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML Sitemap getServerSideProps: 404 in production #3596 #338

Open
nuhardlopen opened this issue Dec 23, 2023 · 2 comments
Open

XML Sitemap getServerSideProps: 404 in production #3596 #338

nuhardlopen opened this issue Dec 23, 2023 · 2 comments

Comments

@nuhardlopen
Copy link

Almost everything in my NextJS is getStaticProps.
I only generate the dynamic XML Sitemaps with getServerSideProps. If I check it localhost it is working, in production the URL it is giving a 404.
Also did a test without .xml extensions, just a getServerSideProps test page. Also gets a 404.
Looks like the page is nog generated on the server with getServerSideProps.
Scherm­afbeelding 2023-12-23 om 16 28 21

Any ideas to fix this?

SST: 2.38.7
OpenNext v2.3.1
Next.js v14.0.2
https://discord.com/channels/983865673656705025/1027265626085019769/threads/1170375439664025773

@nuhardlopen
Copy link
Author

nuhardlopen commented Dec 27, 2023

I found the "issue".
I have a dynamic route [slug].tsx directly after the root in pages folder.
So I think that was the issue, and why it gaves 404 errors for other pages directly after the root in pages folder.

I have put the sitemaps in a separated folder in pages directory. Now everything is working fine.

Previous

pages
- [slug].tsx
- sitemap-blogs.xml.tsx
- sitemap-categorie.xml.tsx

Now

pages
- [slug].tsx
-- sitemap
--- sitemap-blogs.xml.tsx
--- sitemap-categorie.xml.tsx

@khuezy khuezy reopened this Dec 27, 2023
@khuezy
Copy link
Contributor

khuezy commented Dec 27, 2023

I'll keep this open. We need to investigate the .xml files, I think we may have overlooked that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants