Before Timber version 1.3.1, if you wanted to change the Read More text for a post preview, you could use {{ post.get_preview(50, 'false', 'Keep Reading') }}
. This function has been deprecated and it is recommended to use {{ post.preview }}
, but it doesn't seem to have the ability to filter the Read More text easily.
Asked
Active
Viewed 2,874 times
8
1 Answers
17
It doesn’t seem easy, probably because it isn’t documented yet. But we’re working on it!
{{ post.preview }}
returns a PostPreview
object, which is a chainable object. This means that you can change the output of the preview by adding methods.
In your example, when you want to change the read-more text:
{{ post.preview.read_more('More!') }}
If you’d also want to change the length to 10 words only, you could do something like this:
{{ post.preview.length(10).read_more('More!') }}

Gchtr
- 2,749
- 2
- 18
- 28
-
3post.preview.length(10) only works if I add .force at the end. – Michel Moraes Sep 23 '18 at 18:53
-
.force at the end is vital! – Alchem Oct 31 '18 at 13:25
-
Perfect! @MichelMoraes! Also to hide, we set false into parenthesis. Like that `{{post.preview.length(25).force.read_more(false)}}` – samu101108 Oct 03 '21 at 23:46