🔵
OnlyHtml
  • Getting Started
  • Essentials
  • Section Types
  • Block Types
  • Built-In Helpers
  • Backends
    • Rapid Prototyping
    • Sanity.io
    • Local Files
  • FAQ
Powered by GitBook
On this page
  • Log
  • Split
  • Range
  • JSON
  • Sum
  • Subtract
  • Divide
  • Length
  • Pluck
  • Compare
  • Contains
  • @index

Was this helpful?

Built-In Helpers

Helpers allow you to run functions and transformations while the site is generated. For example we can calculate the time to read by combining divide and length_words functions.

Time to read {{divide (words_length body) 225}}

We can also skip content if a condition happens

{{#compare (length body) 1000 operator="<=" }}
  We have a short body!
{{/compare}}

Log

Log makes debugging templates easier, it is ignored when creating the sites output but will create invoke a log in the console.

{{log "print the current variables" . }}

Split

Range

JSON

Sum

Subtract

Divide

Length

Pluck

Compare

Contains

@index

PreviousBlock TypesNextBackends

Last updated 3 years ago

Was this helpful?