abs
Return the absolute value of a number, discarding any negative signs to produce a non-negative number.
Syntax
{{ number | abs }}Example
{% assign delta = -25 %}{{ delta | abs }} points differenceOutput
25 points differenceThe abs filter returns the absolute mathematical value of a number, stripping any negative sign. If the input is positive or zero, it returns the number unchanged, ensuring clean numerical presentation.
On programmatic SEO landing pages, abs is useful when displaying price variances between local rates and national averages. For example: {% assign gap = row.local_price | minus: row.national_avg %}{{ gap | abs }} difference. This renders clear comparison metrics without negative symbols in copy.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
