Best way to deal with dynamic pages that don't match database record?

If I was tackling this my approach would be:

Creating a server action that fetches the SEO (sounds like you want dynamic SEO) and also in this action a single query that uses the PARAM variable defined in the URL.
Then a condition on wether a record is returned or not. If the query has a record do nothing and if it doesn’t have a redirect step that goes to a 404

Place this action as the server side data for the content page

Then another server action to load the actual page data and a server connect on the page.

This also may help a little: NodeJS - when using dynamic URL parameters - how can I return a 404 or redirect if no match is found with all URL parameters

There maybe better approaches but this may help somewhat :slight_smile:

1 Like