I have a Webflow site with a CMS Collection that contains 20 different items. Each item uses the same CMS template page, and within that template, there’s a “Book Now” CTA button that redirects users to a general internal page (e.g. /reservation).
However, for 3 specific items, I need that CTA button to redirect to a different custom URL (also internal to my Webflow site, like /custom-form).
What’s the best way to handle this in Webflow?
I was thinking of adding a new URL field to the CMS Collection called “Custom Form Link”, but I’m not sure how to make the CTA button use that field only when it’s filled, and fallback to the default link (e.g. /reservation) when it’s empty.
Is there a way to set conditional linking or fallback logic in Webflow’s CMS templates?
Hi Josefina, I think you can set a unique link destination url on instances of a component. The CMS way you’ve suggested might be possible but I’ve not tried that.
The easiest way is to have two different versions of the link. One uses the “current item” link generated by the CMS, the other uses your custom link. Then you just conditionally show/hide those sections depending on the presence / absence of the custom link.
If you want cleaner HTML, then as Graham suggested you could use a component and also add a switch field to the CMS which lets you control which link block is actually rendered as HTML ( use the visibility property ).
Another way I do this is using custom code. Bind your link to the “current item”, and then create a custom attribute that is bound to your custom link, e.g. override-link. The code checks for those, and when they have content it overrides the href with the override URL. This gives cleaner html and a cleaner designer experience as well, but requires a small bit of coding.