Referencia de filtros
Todos los filtros disponibles en los templates, organizados por categoría. Se usan con la pipe |:
{{ product.price | money_with_currency: store.currency_symbol }}
{{ product.title | upcase | truncate: 30 }}
Moneda
| Filtro | Firma | Descripción | Ejemplo |
|---|---|---|---|
money | money(cents) | Formato simple | {{ 15000 | money }} → "150.00" |
money_with_currency | money_with_currency(symbol, cents) | Con símbolo | {{ money_with_currency "S/" 15000 }} → "S/ 150.00" |
money_with_currency_short | money_with_currency_short(symbol, cents) | Sin decimales si es entero | {{ money_with_currency_short "$" 1500 }} → "$15" |
money_without_currency | money_without_currency(cents) | Sin símbolo | {{ 15000 | money_without_currency }} → "150.00" |
currency_symbol | currency_symbol(code) | Código → símbolo | {{ "PEN" | currency_symbol }} → "S/" |
money_format | money_format(format, code, cents) | Formato custom | {{ money_format "{symbol} {amount}" "PEN" 15000 }} |
money_localized | money_localized(locale, code, cents) | Separadores por locale | {{ money_localized "es" "PEN" 15000 }} → "150.00" |
Texto
| Filtro | Firma | Descripción | Ejemplo |
|---|---|---|---|
capitalize | capitalize(s) | Mayúscula inicial por palabra | "hola mundo" → "Hola Mundo" |
upcase | upcase(s) | Todo mayúsculas | "hola" → "HOLA" |
downcase | downcase(s) | Todo minúsculas | "HOLA" → "hola" |
lstrip | lstrip(s) | Recortar izquierda | " hola" → "hola" |
rstrip | rstrip(s) | Recortar derecha | "hola " → "hola" |
trimSpace | trimSpace(s) | Recortar ambos lados | " hola " → "hola" |
truncate | truncate(n, s) | Truncar a N chars + "..." | {{ "texto largo" | truncate: 5 }} → "text…" |
truncatewords | truncatewords(n, s) | Truncar a N palabras | {{ "dos palabras más" | truncatewords: 2 }} → "dos palabras…" |
replace | replace(old, new, s) | Reemplazar todos | {{ "a-b-c" | replace: "-", " " }} → "a b c" |
replace_first | replace_first(old, new, s) | Reemplazar primera ocurrencia | |
remove | remove(target, s) | Eliminar todas las ocurrencias | {{ "hola hola" | remove: "hola" }} → " " |
remove_first | remove_first(target, s) | Eliminar primera ocurrencia | |
strip_newlines | strip_newlines(s) | Eliminar \n | |
strip_html | strip_html(s) | Eliminar tags HTML | {{ "<b>hi</b>" | strip_html }} → "hi" |
newline_to_br | newline_to_br(s) | \n → <br> | |
escape | escape(s) | Escapar HTML entities | "a&b" → "a&b" |
escape_once | escape_once(s) | Escapar sin duplicar | "a&b" → "a&b" (no cambia) |
handleize | handleize(s) | Slug URL | "Mi Tema Cool!" → "mi-tema-cool" |
prepend | prepend(prefix, s) | Anteponer string | {{ "mundo" | prepend: "hola " }} |
append | append(suffix, s) | Anteponer string | {{ "hola" | append: " mundo" }} |
split | split(sep, s) | Dividir string | {{ "a,b,c" | split: "," }} → ["a","b","c"] |
splitLines | splitLines(s) | Dividir por saltos de línea | |
blank | blank(s) | true si vacío/whitespace | |
present | present(s) | true si tiene contenido | |
raw | raw(s) | Marcar como HTML seguro |
URL / Encoding
| Filtro | Firma | Descripción | Ejemplo |
|---|---|---|---|
url_encode | url_encode(s) | Percent-encode | "hola mundo" → "hola%20mundo" |
url_decode | url_decode(s) | Percent-decode | |
url_for | url_for(pageType, handle) | Generar URL | {{ url_for "product" "camisa-roja" }} → "/products/camisa-roja" |
base64_encode | base64_encode(s) | Base64 encode | |
base64_decode | base64_decode(s) | Base64 decode |
Hashing
| Filtro | Firma | Descripción |
|---|---|---|
md5 | md5(s) | MD5 hex digest |
sha1 | sha1(s) | SHA-1 hex digest |
sha256 | sha256(s) | SHA-256 hex digest |
Imagen / Media
| Filtro | Firma | Descripción | Ejemplo |
|---|---|---|---|
img_url | img_url(size, url) | Agregar parámetro de tamaño | {{ img_url "400x400" url }} → "url?size=400x400" |
img_tag | img_tag(image) | Tag <img> completo con lazy loading | |
img_srcset | img_srcset(sizes, baseURL) | Atributo srcset | |
image_url | image_url(params, url) | URL con parámetros de imagen | |
image_tag | image_tag(image) | Alias de img_tag | |
asset_url | asset_url(filename) | URL del asset del tema | |
asset | asset(filename) | URL fingerprinted del asset | {{ "theme.css" | asset }} |
asset_img_url | asset_img_url(filename) | URL de asset imagen | |
video_tag | video_tag(source, attrs) | Tag <video> completo | |
external_video_url | external_video_url(host, videoID) | URL embed YouTube/Vimeo |
Array / Slice
| Filtro | Firma | Descripción |
|---|---|---|
first | first(arr) | Primer elemento |
last | last(arr) | Último elemento |
reverse | reverse(arr) | Array invertido |
sort | sort(arr) | Ordenar alfabéticamente |
sort_natural | sort_natural(arr) | Orden natural (números) |
uniq | uniq(arr) | Eliminar duplicados |
compact | compact(arr) | Eliminar nil |
where | where(field, value, arr) | Filtrar donde field == value |
reject | reject(field, value, arr) | Inverso de where |
find | find(field, value, arr) | Primera coincidencia |
group_by | group_by(field, arr) | Agrupar por campo |
sum | sum(field, arr) | Sumar campo numérico |
min | min(arr) | Mínimo |
max | max(arr) | Máximo |
sample | sample(n, arr) | N elementos aleatorios |
push | push(elem, arr) | Agregar elemento |
concat | concat(arr2, arr) | Concatenar arrays |
size | size(v) | Longitud de array/string/map |
map | map(field, arr) | Extraer campo de cada elemento |
Matemáticas
| Filtro | Firma | Descripción |
|---|---|---|
plus | plus(a, b) | Suma |
minus | minus(a, b) | Resta |
times | times(a, b) | Multiplicación |
divided_by | divided_by(a, b) | División |
modulo | modulo(a, b) | Módulo |
abs | abs(n) | Valor absoluto |
ceil | ceil(n) | Redondear arriba |
floor | floor(n) | Redondear abajo |
round | round(n) | Redondear al entero más cercano |
at_least | at_least(n, val) | Mínimo garantizado |
at_most | at_most(n, val) | Máximo garantizado |
mul | mul(a, b) | Multiplicación (int64) |
add | add(a, b) | Suma (int64) |
div | div(a, b) | División (int64, 0-safe) |
int64 | int64(v) | Cast a int64 |
atoi | atoi(s) | String a entero |
Fecha / i18n
| Filtro | Firma | Descripción |
|---|---|---|
date | date(layout, time) | Formato de fecha Go |
time_ago | time_ago(time) | "hace 3 días" (español) |
time_ago_in_words | time_ago_in_words(time) | Alias de time_ago |
localize_date | localize_date(locale, layout, time) | Fecha localizada |
Layouts de fecha comunes
| Layout | Output |
|---|---|
"2006-01-02" | 2024-01-15 |
"02/01/2006" | 15/01/2024 |
"January 2, 2006" | January 15, 2024 |
"15:04" | 14:30 |
Peso
| Filtro | Firma | Descripción |
|---|---|---|
weight_with_unit | weight_with_unit(unit, grams) | "1.5 kg" |
convert_weight | convert_weight(from, to, grams) | Conversión de unidades |
URL / Links
| Filtro | Firma | Descripción |
|---|---|---|
link_to | link_to(url, text) | Tag <a> |
link_to_tag | link_to_tag(tag, text) | Link a colección por tag |
default_pagination | default_pagination(pagination) | HTML de paginación |
pluralize | pluralize(singular, plural, count) | Singular/plural |
CSS / HTML
| Filtro | Firma | Descripción |
|---|---|---|
cssVars | cssVars(pairs...) | Bloque de variables CSS custom |
cssBlock | cssBlock(selector, body) | Regla CSS envuelta |
jsonStr | jsonStr(v) | JSON para contexto <script> |
is_dark | is_dark(hex) | Check de luminancia (BT.601) |
isVideoURL | isVideoURL(url) | Detectar .mp4/.webm/.mov |
googleFontsURL | googleFontsURL(fonts...) | URL de Google Fonts CSS2 |
Utilidades
| Filtro | Firma | Descripción |
|---|---|---|
default | default(fallback, value) | Fallback si vacío |
json | json(v) | Serializar a JSON |
inspect | inspect(v) | Representación debug Go |
list | list(values...) | Crear array |
dict | dict(key, val, ...) | Crear map |
until | until(n) | [0, 1, ..., n-1] |
seq | seq(n) | [1, 2, ..., n] |
now | now() | {Year: 2025} |
year | year(v) | Extraer año |
slice | slice(s, a, b) | Substring |
sectionBase | sectionBase(id) | Strip sufijo __suffix de section ID |
menu | menu(ctx, handle) | Menú de navegación por handle |
t | t(lang, key) | Lookup de traducción i18n |
Datos de sección (parse JSON en templates)
| Filtro | Firma | Descripción |
|---|---|---|
parseSlides | parseSlides(raw) | Parsear JSON de hero slides |
sectionStr | sectionStr(section, key) | Obtener string de section map |
galleryItems | galleryItems(section, key) | Parsear items de galería |
sectionFAQItems | sectionFAQItems(section, key) | Parsear items de FAQ |
sectionTestimonialsItems | sectionTestimonialsItems(section, key) | Parsear items de testimonios |