fix: add secondary sort by date_created so articles without published_at show up in listings
This commit is contained in:
@@ -22,7 +22,7 @@ export default function LoadMoreButton({ categorySlug, initialCount, hasMore: in
|
|||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
'filter[status][_eq]': 'published',
|
'filter[status][_eq]': 'published',
|
||||||
'filter[category][slug][_eq]': categorySlug,
|
'filter[category][slug][_eq]': categorySlug,
|
||||||
sort: '-published_at',
|
sort: '-published_at,-date_created',
|
||||||
limit: '12',
|
limit: '12',
|
||||||
offset: String(offset),
|
offset: String(offset),
|
||||||
fields:
|
fields:
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ export async function getArticles(options: {
|
|||||||
'category.id', 'category.name', 'category.slug',
|
'category.id', 'category.name', 'category.slug',
|
||||||
],
|
],
|
||||||
filter,
|
filter,
|
||||||
sort: ['-published_at'],
|
sort: ['-published_at', '-date_created'],
|
||||||
limit,
|
limit,
|
||||||
offset,
|
offset,
|
||||||
})
|
})
|
||||||
@@ -121,7 +121,7 @@ export async function getRelatedArticles(
|
|||||||
category: { slug: { _eq: categorySlug } },
|
category: { slug: { _eq: categorySlug } },
|
||||||
slug: { _neq: excludeSlug },
|
slug: { _neq: excludeSlug },
|
||||||
},
|
},
|
||||||
sort: ['-published_at'],
|
sort: ['-published_at', '-date_created'],
|
||||||
limit: 4,
|
limit: 4,
|
||||||
})
|
})
|
||||||
) as Promise<Article[]>
|
) as Promise<Article[]>
|
||||||
|
|||||||
Reference in New Issue
Block a user