Add sorting options to blog page and CMS clients

This update enables sorting of blog page entries based on 'publishedAt' date or custom order. This flexibility has been implemented across the marketing blog page, Keystatic, Wordpress, and Core CMS client services. This functionality allows more control over the presentation of entries.
This commit is contained in:
giancarlo
2024-04-15 16:02:14 +08:00
parent cb690ec317
commit 2927d9980b
4 changed files with 55 additions and 21 deletions

View File

@@ -38,6 +38,14 @@ export class WordpressClient implements CmsClient {
queryParams.append('offset', options.offset.toString());
}
if (options.sortBy) {
queryParams.append('orderby', options.sortBy);
}
if (options.sortDirection) {
queryParams.append('order', options.sortDirection);
}
if (options?.categories) {
const ids = await this.getCategories({
slugs: options.categories,