Skip to content

Commit 6ee9c17

Browse files
other fix
1 parent e0d82d9 commit 6ee9c17

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

layouts/_default/search.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ <h1 class="py-4">{{ .Title }}</h1>
112112
const resultsLength = search.results.length;
113113
// Get the data for the search results
114114
// Slice the results based on the range start + 10
115-
const resultsData = await Promise.all(
116-
search.results.slice(rangeStart, rangeEnd).map((r) => r.data()),
115+
const fullResultsData = await Promise.all(
116+
search.results.map((r) => r.data())
117117
);
118+
const resultsData = fullResultsData.slice(rangeStart, rangeEnd);
118119
// If the range does not have any results, display a message
119120
if (resultsData.length === 0) {
120121
searchPageResults.innerHTML = `<div class="p-4">No results found</div>`;
@@ -123,7 +124,7 @@ <h1 class="py-4">{{ .Title }}</h1>
123124
// Add an index to the results, for heap tracking
124125
const results = resultsData.map((item, index) => ({
125126
...item,
126-
index: index + 1,
127+
index: rangeStart + index + 1,
127128
}));
128129

129130
// If the query is not empty, display the search results container

0 commit comments

Comments
 (0)