Create Contentful Custom Slug Prefix

I’m currently using the Contentful ‘slug generator’ widget which auto-generates a slug from the Title field. Is there a way I can automatically add a prefix to the slug? Ex:

Current: Post Title -> post-title
What I want: Post Title -> post/post-title

I know I can manually add post/, but I forget sometimes. (I’m using Contentful with Gatsby)

Hi @kenold,
There’s not an out of the box feature for this but you could implement an additional functionality to automatically do that through an UI extension.

More information can be found in the following link:

https://www.contentful.com/developers/docs/extensibility/ui-extensions/

Thanks a lot. That helped. I cloned and modified the original ‘slug generator’ extension and it worked.

function setSlug (slug) {
  	var preSlug = 'post/' + slug
    input.value = preSlug
    slugField.setValue(preSlug)
    setStatus('loading')
    debouncedUpdateStatus(preSlug)
  }

It’s hardcoded for now, but hopefully, I’ll have enough time to display an input field so I can set any prefix.

Hi,
I’m trying to modify the original slug generator, however, the instructions mention a Makefile which I can’t find anywhere.

Where is that Makefile?

Thanks!