patronage / bubs-next

Headless Wordpress + Next.js Project scaffolding
https://bubs-next.vercel.app
MIT License
37 stars 10 forks source link

Redirect Management #57

Closed ccorda closed 2 years ago

ccorda commented 3 years ago

Something clients often want are the ability to set and manage redirects, including for renamed posts.

If using the premium version of Yoast, those redirects are in graphql: https://github.com/ashhitch/wp-graphql-yoast-seo/issues/38

ccorda commented 3 years ago

Looks like you can do dynamic redirects in the next config file: https://github.com/vercel/next.js/discussions/15344

I'm going to give this a try tomorrow.

ccorda commented 3 years ago

Let's get this into a future release -- we have an OK enough version working with Yoast Premium, and there is now an option for Redirection: https://wordpress.org/plugins/add-wpgraphql-redirection/

The one drawback I've seen is that it requires the redirect to exist at build time.

It might be worth seeing if we can do something with 404s to check the live graphql for a redirect path.

kylehotchkiss commented 3 years ago

Did we find a way to execute redirects after build in any recent projects?

ccorda commented 2 years ago

This one is implemented. Have a few cleanup tasks/bugs that will get fixed in a new PR shortly.