{{ $limit := .Site.Params.algoliaSearch.limit | default 1000 }}
[
  {{ range $index, $entry := where .Site.RegularPages "Kind" "page" }}
  {{ if $index }}, {{ end }}
  {
    "objectID": "{{ .Date.Unix }}",
    "permalink": "{{ .Permalink | relURL }}",
    "title": {{ .Title | jsonify }},
    {{ if gt .WordCount $limit }}
    "content": {{ .Plain | truncate $limit | jsonify | safeJS }},
    {{ else }}
    "content": {{ .Plain | jsonify | safeJS }},
    {{ end }}
    "date": {{ .Date.Format $.Site.Params.timeFormat | jsonify }},
    "updated": {{ .Lastmod.Format $.Site.Params.timeFormat | jsonify }}
  }
  {{ end }}
]