JEverhart383 / astro-wordpress-starter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imported category and tag archive pages leading to 404

djmtype opened this issue · comments

If I start a brand new WP project with categories and tags, the routes work just fine in Astro; even with prerender = true.

However, if I import a WP database dump or XML file containing pre-existing categories and tags, they lead to a 404 in my testing. I tried this with 2 completely different WP projects.

When I commented out export const prerender = true in [...uri].astro, those previous 404 routes were now working and valid.

I thought after restarting the server, if I set prerender back to true, the routes would be valid, but once again, they lead to a 404.

I flushed my browser cache and cleared site data in dev tools > Application > Storage. I also tested in other browsers.

If it's failing on prerender, it's likely because some of the term paths are not included in the getAllUris return object. Can you check how many terms exist between tags, categories, and any custom taxonomies in the WP dashboard. By default, you can only return 100 terms, so if there are more than that, some will be excluded from the function that gets possible URIs. It works when removing the pretender b/c it is a valid URI, so everything resolves. I experienced this as well when working on my own personal site, and I think the solution will be writing a different function to paginate through all available terms

Thanks very much for the explanation Jeff. I see this is related to #2