diff options
-rw-r--r-- | themes/default/layouts/_default/index.json | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/themes/default/layouts/_default/index.json b/themes/default/layouts/_default/index.json index 0c9c794..78c0fde 100644 --- a/themes/default/layouts/_default/index.json +++ b/themes/default/layouts/_default/index.json @@ -7,8 +7,10 @@ "next_url": "{{ .URL }}", {{- end }} "items": [ - {{- range $index, $data := .Paginator.Pages -}} - {{- if and (ne $data.Type "json") (not .ExpiryDate) (not .Params.unlisted) -}} + {{- $notExpired := where .Paginator.Pages "Params.expirydate" "eq" nil -}} + {{- $notUnlisted := where .Paginator.Pages "Params.unlisted" "eq" nil -}} + {{- $filteredPages := $notExpired | intersect $notUnlisted -}} + {{- range $index, $data := $filteredPages -}} {{- if and $index (gt $index 0) -}},{{- end }} { "id": "{{ md5 $data.Permalink }}", @@ -37,7 +39,6 @@ "content_text": {{ $data.Plain | jsonify }}, "content_html": {{ partial "function-content.html" $data | jsonify }} } - {{- end -}} - {{ end }} + {{- end }} ] } |