How to create a custom segment?
# help-with-umbraco
d
Has anyone created a segment in Umbraco 10 before? I'm trying to follow this blog post, but the
DeepClone
method seems to have disappeared from the variant model since. I was wondering if anyone had a more up-to-date example. It feels wrong to manually clone the variant model. https://24days.in/umbraco-cms/2022/using-segmentation/
I'm actually surprised it works at all. The collection is modified inside its own loop
n
I'd be keen to know if you had any luck. This feature is a bit too hidden I think. Ideally it would be visible as an option by default. It's not very discoverable at the moment, so it's less likely to see use / contributions.
d
Well I have been able to create custom segments. The backoffice is still rather buggy because of the manual cloning, but on the frontend it works pretty well. Fallback is also a little wonky, but with a little magic on the fallback service, I managed to add a fallback to the default variant. To enable segmentation on a document type, I created a little class library that adds a button in the backoffice: