Limit and Paginate API/Data

Is there a way to limit data in a loop? I tried adding “first 5” but it didn’t work.

{{ $url := "/data/products.json" }}
{{ $data := getJSON $url}}

{{ range first 5 $data.list }}
	{{ $item := . }}
	{{ $item.title }}
{{ end }}

Also, if I pull all data, how can I add pagination?

Currently, Hugo only supports pagination for pages but not for data files.

@digitalcraftsman I’m having the same issue. Is there any way to go around this? I’m pulling data from an API.

Sadly, I’m not aware of a any workaround to make it work. But there is already an issue/feature request on GitHub: