Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

News/Blog - "Recent posts" on homepage not sorted chronologically / not displaying most recent articles #8

Open
megoconnor opened this issue Mar 3, 2021 · 1 comment

Comments

@megoconnor
Copy link

Description

The articles under the "Recent posts" listing on the homepage in the News/Blog site aren't sorted in chronological order, so some recent articles may not be displayed.

Workaround

Edit the _cms/formats/default-home Format and add sort parameters to the query. Change Line 10 from:

#set($posts  = $_.query().byContentType('Post').hasMetadata('feature', 'No').maxResults(25).execute())

to

#set($posts  = $_.query().byContentType('Post').hasMetadata('feature', 'No').sortBy("startDate").sortDirection("desc").maxResults(25).execute())

This sorts the articles by their Start Date ("startDate") but you may wish to sort them by their Create date instead ("created"). More information on the sortBy method.

@megoconnor
Copy link
Author

Conversation 69364500009472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant