> For the complete documentation index, see [llms.txt](https://cryptococo.gitbook.io/cocoshop-theme-development/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cryptococo.gitbook.io/cocoshop-theme-development/liquid/filters.md).

# Filters

Filters are simple methods that allow you to modify and manipulate the output of a Liquid object or variable. They can be applied to an object or variable using the pipe character `|` followed by the filter name and any optional parameters. Filters can be chained together to perform multiple operations on the data.

### Basic Syntax

The basic syntax for using a filter is:

```liquid
{{ object | filter_name: parameter1, parameter2, ... }}
```

Example: Using the `replace` filter to replace "example" with "sample" in a string

```liquid
{{ "This is an example text." | replace: "example", "sample" }}
```

Output:

```vbnet
This is a sample text.
```

### Chaining Filters

You can chain multiple filters together by adding additional pipe characters `|` and filter names with their parameters. The filters will be applied in the order they are written.

Example: Using the `upcase` filter and the `replace` filter together

```arduino
{{ "This is another example." | upcase | replace: "EXAMPLE", "sample" }}
```

Output:

```vbnet
THIS IS ANOTHER sample.
```

### Built-in Filters

Liquid comes with a variety of built-in filters for common tasks such as string manipulation, formatting numbers, and working with dates. Some examples of built-in filters include `capitalize`, `truncate`, `round`, and `date`.

Example: Using the `truncate` filter to limit a string to 10 characters

```bash
{{ "This is a very long text." | truncate: 10 }}
```

Output:

```csharp
This is a...
```

For more details on filters, including a comprehensive list of built-in filters, please refer to the LiquidJS documentation:

[LiquidJS Filters Documentation](https://liquidjs.com/filters/overview/)

By using filters in your Liquid templates, you can easily manipulate data and create dynamic content based on various conditions, greatly enhancing the functionality of your web application.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cryptococo.gitbook.io/cocoshop-theme-development/liquid/filters.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
