Keep your content consistent with input validation

3 Jul 2025
Keep your content consistent with input validation

Your content team has accidentally published a 400-character meta description that gets brutally chopped off by Google. Or someone’s uploaded 17 images to what was supposed to be a "featured trio" gallery, blowing your design rules out of the water. We've been there. Let’s stop it happening again.

One of your most requested features has officially landed: with input validation, you get to be the rule-maker. Set the boundaries that make sense for your projects, your content teams, and your sanity. (And all validation happens before any content is saved in CloudCannon, which means any issues will be caught before they make it to your live site.)

Find out more about how input validation works in our documentation.

How it works Direct link to this section

The new validation system integrates seamlessly into your existing CloudCannon workflow. When editors try to save content that doesn’t meet your validation rules, the interface will clearly highlight what needs fixing and how to resolve it.

Components in your live preview will continue to render regardless of validation status — it’s up to your components to handle invalid input gracefully. They might show placeholders, warnings, or other indicators when required data is missing or invalid.

I’m seeing a new error message — what happened? If you have set min/max values of number inputs and any existing values for those inputs are outside this range, your users will see a new error message. To address this issue, you can either correct the input value or adjust your preset min / max value.

Validation rules you can set Direct link to this section

The initial release includes the most commonly requested validation types:

  • Text length validation keeps content within bounds — perfect for SEO titles and meta descriptions that need to meet specific character limits.
  • Number ranges ensure numeric inputs stay within acceptable values, whether that's pricing, quantities, or measurements.
  • Array controls let you set minimum and maximum item counts for galleries, featured lists, and card collections. You can also enforce uniqueness to prevent duplicate entries.
  • Date and time ranges restrict when events can be scheduled or limit historical data to specific periods.
  • File size limits prevent oversized images from slowing down your site.
  • Pattern matching validates formats like email addresses, URLs with specific protocols, or custom patterns like product codes.
  • Conditional validation works intuitively with your existing input configuration. CloudCannon automatically skips validation for any inputs that are currently hidden or disabled — no additional setup required.
  • Custom error messages give you complete control over how validation errors are presented to your content teams. Every validation rule supports a corresponding _message key, so you can provide clear, contextual guidance instead of generic error messages. (Thanks to our community members for feedback that prompted this additional feature!)

Real-world examples Direct link to this section

Here’s how a few sample validation rules look in practice:

Keeping blog titles SEO-friendly with custom guidance Direct link to this section

title: 'How to optimize your website'

_inputs:
title:
type: text
options:
max_length: 60
max_length_message: 'Keep your title under 60 characters for better readability'
min_length: 10
min_length_message: 'Title should be at least 10 characters for clarity'
required: true
required_message: 'A descriptive title is required for this post'
featured_products:
- /products/laptop.md
- /products/phone.md
- /products/tablet.md

_inputs:
featured_products:
type: array
options:
min_items: 3
max_items: 6
unique_on: '$'

Validating email newsletter signup forms Direct link to this section

contact_email: editor@example.com

_inputs:
contact_email:
type: email
options:
pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}'
pattern_message: 'Please enter a valid email address'

Building for your workflow Direct link to this section

We’re always aiming for features that appeal to the sweet spot where developer control meets editor clarity. Here, you get to set the guardrails that keep your data squeaky clean, while your content team gets the kind of helpful nudges that actually make their job easier.

It’s the kind of win-win that (hopefully) makes everyone’s day a little bit better.

What’s coming next Direct link to this section

While not part of the initial release, we’re also exploring JSON Schema validation for more complex scenarios. This would enable advanced object validation and intricate array rules — like ensuring only one item in a list is marked as "featured" while maintaining unique identifiers across all items. Let us know your thoughts in the Community!

Launch your website today

Give your content team full autonomy on your developer-approved tech stack with CloudCannon.

Get started free!

You might also like: