Silex CMS uses Liquid filters and Eleventy filters to manipulate data in a no-code way. Filters are applied to tokens (building blocks of expressions), such as GraphQL data, custom states, or pagination objects. Users can add filters through an intuitive UI and configure their options by clicking the “...” icon.
For more information:
Expressions in Silex CMS are made of tokens and filters, assembled in a no-code fashion. You can:
For detailed examples, see the Silex CMS documentation.
Filters from @silexlabs/grapesjs-data-source are sourced from the GrapesJS plugin and are available in the grapesjs-data-source repository.
Filters from @silexlabs/silex-cms are added by the Silex CMS plugin, available in the silex-cms repository. They require that you install 11ty plugins
strip_html
Removes HTML tags from a string.
string
containing HTML.string
.<h1>Title</h1>
Title
append
Appends a string to the input.
string
.value
(the suffix to append).string
.Hello
{ value: ' World' }
Hello World
prepend
Prepends a string to the input.
string
.value
(the prefix to prepend).string
.World
{ value: 'Hello ' }
Hello World
where
Filters an array of objects by a key-value pair.
key
(the object key to filter on), value
(the value to match).[ { id: 1 }, { id: 2 } ]
{ key: 'id', value: 1 }
[ { id: 1 } ]
find
Finds the first object in an array that matches a key-value pair.
key
(the object key to filter on), value
(the value to match).[ { id: 1 }, { id: 2 } ]
{ key: 'id', value: 2 }
{ id: 2 }
first
Gets the first item in an array.
[1, 2, 3]
1
last
Gets the last item in an array.
[1, 2, 3]
3
join
Joins an array of strings with a separator.
separator
(default: ,
).['a', 'b', 'c']
{ separator: '-' }
a-b-c
split
Splits a string into an array using a separator.
string
.separator
(default: ,
).a,b,c
{ separator: ',' }
[ 'a', 'b', 'c' ]
map
Maps an array of objects to a specific key.
key
(the key to map).[ { id: 1 }, { id: 2 } ]
{ key: 'id' }
[ 1, 2 ]
reverse
Reverses the order of an array.
[1, 2, 3]
[3, 2, 1]
log
Logs the input to the console.
Hello
Hello
Hello
slugify
Converts a string to a URL-friendly slug.
string
.string
.Hello World
hello-world
image
Generates an HTML <img>
tag for a given image URL.
alt
(alt text), sizes
(image sizes), widths
(image widths).<img>
tag as a string.photo.jpg
{ alt: 'Photo', sizes: '100vw' }
<img src="photo.jpg" alt="Photo" sizes="100vw" />
locale_url
Generates a localized URL.
string
(URL).locale
(language locale)./about
{ locale: 'fr' }
/fr/about
locale_links
Generates links for all available locales.
string
(URL)./about
[
{ "url": "/about", "lang": "en", "label": "English" },
{ "url": "/fr/about", "lang": "fr", "label": "Français" }
]