Tera question about truncate and strip the content

We have the Tera builtin truncate function that is useful for providing the x number of characters in the paginated section.

{{ page.content | truncate(length=100) }}

Is there a builtin that will strip out the first x characters. Cannot find one similar

{{ page.content | strip(length=100) }}

And any known method or idea for truncating to the end of a word rather than a charac…

To me, this seems like a potential useful feature, but I wouldn’t call it strip as I think it would be confused for the existing trim filter.

One could probably implement an optional start argument to the existing truncate filter – truncation is also the correct verb for left trimming too, not just right trimming. So it’d be something like this:

{{ value | truncate(start=50, length=100) }}

Of course, then it’d be confusing API if start was an int and end was a string – maybe deprecate end and offer new prefix / suffix arguments for when you use characters other than “…”.

Alternatively a more general like substring could be quite useful too:


returns a substring given start and end parameters. Both parameters are optional an omitting them returns the same string.

{{ value | substring(start=100) }}

Either way, the Tera project github is probably the right place to file an issue as Zola is but one of many projects using Tera for templating.

start and length is ideal.
Yeah thats fine. substr, trunc or anything. I need it.