rstrip

Remove all trailing whitespace, tabs, and newline characters from the right side of a string.

Syntax

{{ string | rstrip }}

Example

{% assign text = "Trailing Space " %}[{{ text | rstrip }}]

Output

[Trailing Space]

The rstrip filter trims all trailing whitespace characters—including spaces, tabs, and line endings—from the right edge of a string while preserving leading and internal spacing.

On keyword combination landing pages, rstrip eliminates unwanted whitespace at the end of CSV cell values before concatenating punctuation or closing quotation marks. For example: "{{ row.tagline | rstrip }}" by {{ row.brand_name }}. This prevents unsightly gaps between trailing words and subsequent punctuation marks across thousands of generated pages.

Try this syntax in the editor.