Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form
The switch field is a CMS field used in Collections, usually as a filtering tool. Like any toggle, it has two values: Yes or No. Collaborators can toggle a switch on or off to specify, for example, if a blog post “is featured.”
Want to follow along with this lesson? Fortunately, we created a zip file which contains all the assets used in the project, and we've included that linkright here
Switches are extremely useful when you're looking to filter elements based on something binary. An on or off or yes or no option.
Is this film black and white?
Is this company a non-profit?
Is this blog post featured?
This concept can be extended indefinitely. And when you add a filter? Simply select the Switch, and specify whether you're looking to display items that have the Switch on, or those that have the Switch off. The result of this filter is displaying only the results that fit this new Switch.
We can also create a Switch called "Show contact form" and go into our Collection Page? We can actually select an entire element inside — for our sign up div block — and set conditional visibility. We can go in and set a condition that shows this div block only if "Show contact form" is Switched on.
So. Switches. The word sounds odd the more you say it. The field is a powerful and straightforward way to work with dynamic content.
Thanks for the feedback! This will help us improve our content.
Something went wrong while submitting the form. Please contact email@example.com