Contentful logo

Contentful Community

SEO Redirect / validation

I would like to track changes to seo-slugs to automatically render a 301/2 (for bots), and just load the newest version for SPAs when accessing an url. The handling of the redirect would be done from the frontend consuming the content.

I have on my content type a text field with the seo slug editor on it, and I assume I can use webhooks to pay attention to when such a field is changed and record it back.

Is there already some demo-code available to achieve something like this?

Br
Asger Jensen

Hi @asger.jensen,
We don’t have a demo code at hand but it is something you could easily do using one of our SDKs.

As described in the following link, you could make use of filters to make sure that you’re receiving calls from specific entities and ease the entire process:

https://www.contentful.com/developers/docs/concepts/webhooks/#filters