Get entry by vuid

Hi!

I’m using the content versioning plugin. I’m having trouble deciding on how to format my URL:s on my site.

The content versioning plugin doesn’t work with unique fields, so I can’t keep (unique) slugs in my Strapi model. It also creates new entry id:s for every new version it saves, making it impossible to have / as URL on my site.

I’m thinking I could use the content entry’s vuid field for a true unique field, which is not “altered” by the plugin. Like this: /. Is there any way to fetch an entry from native Strapi by vuid?

Have anyone else experienced a similar problem? How did you solve it?

You could use lifecycle hooks and onCreate you create a uuid field that is a random string :slight_smile:
Then you can concatinate some of the uuid and the slug

Yeah, that’s true. But that would be pretty similar to the vuid which is already present on the entry by default.

My main question is if there’s any way to fetch entries by anything else than just the regular id… Do you know?

You can extend or customise the controller to do this. Default findOne will expect and I’d but you can use findMany and filters i guess to filter of your vuid

Ah, I totally forgot about custom controllers… Sorry to take up your time. Thanks a lot for the help!

1 Like