Skip to content

Commit

Permalink
fix(site): improve page rendering logic
Browse files Browse the repository at this point in the history
refactored the way pages are processed by storing regular pages in a variable and calculating their length. this simplifies the loop and ensures proper comma placement between items.
  • Loading branch information
Vheissu committed Dec 13, 2024
1 parent 9a3fd38 commit b368b43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions themes/aurelia-theme/layouts/_default/index.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"pages": [
{{- range $index, $page := .Site.RegularPages -}}
{{- if $index -}}, {{- end }}
{{- $pages := .Site.RegularPages -}}
{{- $len := len $pages -}}
{{- range $index, $page := $pages -}}
{
"title": {{ $page.Title | jsonify }},
"content": {{ $page.Plain | jsonify }},
"permalink": {{ $page.Permalink | jsonify }},
"summary": {{ $page.Summary | jsonify }},
"type": {{ $page.Type | jsonify }},
"section": {{ $page.Section | jsonify }}
}
}{{- if not (eq (add $index 1) $len) -}},{{- end -}}
{{- end -}}
]
}

0 comments on commit b368b43

Please sign in to comment.