Sumary of 3 post of 20 last posts

I am looking ins a way to pick random 3 posts from the last 20 and put their summary on a sidebar

any ideas ?

I haven’t tested the code but I could give you an approach:

{{ $pages := first 3 (first 20 .Data.Pages | shuffle) }}

{{ range $pages }}
    {{ .Summary }}
{{ end }}

First of all take the last 20 pages, shuffle them randomly and take the first 3 random posts. Afterwards, we can range over them.

3 Likes