strapi-webtools icon indicating copy to clipboard operation
strapi-webtools copied to clipboard

[Feature] Allow simple pseudo logic in patterns.

Open douwepausma opened this issue 2 months ago • 3 comments

Addon

No specific addon – This feature request is related to Webtools Core

Summary

Allow simple pseudo logic, like a shorthand if-else statement, to use fixed strings or other fields based on the value of the checked field. See suggested solution for an example.

Why is it needed?

In our case we have a vacancy content-type which has a toggle called volunteer that decides whether it's a payed position or not. We use the sames content-type as all the fields are in common. Some simple logic like the example below could be very use full in displaying the content under a different parent page. I can imagine other areas where this functionality could be useful as well.

Suggested solution(s)

# volunteer = true
# slug = barkeeper
/[volunteer ? 'volunteer' : 'careers']/[slug]
-> "/volunteer/barkeeper"

# volunteer = false
# slug = accountant
/[volunteer ? 'volunteer' : 'careers']/[slug]
-> "/careers/accountant"

Related issue(s)/PR(s)

Maybe this can be implemented in conjunction with #283

douwepausma avatar Nov 05 '25 14:11 douwepausma