I want to remove the 3 dots added at the end of truncate

{{ $summary := replace (.Summary | truncate 100) "..." "" }}

When I use truncate 100, it adds 3 periods (…) at the end of the text after 100 characters.

I want to remove this, I tried with the code above but it doesn’t work.

Can you help me?

By default truncate add a ellipsis “…” not three separate dots “…”

You can set it to anything you like, including an empty string like this.

{{ $summary := (.Summary | truncate 100 "") }}

See the documentation at:

2 Likes

{{ $summary := (.Summary | truncate 100 "") }}

It worked, thank you.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.