I would like to sort blog articles by date from oldest to newest. Is that possible? thanks

Hi Camille,
Thats done easy.
I gues you have a repeater item connected to a dataset
Open the settings of the dataset en go to sort.
There you can add a sort function, select creates date and set it from new to old.

Kind regards,

Thanks a lot for the answer but I don’t want to sort elements in a repeater container but Date published of Posts in a widget on Blog’s page from old to new. It doesn’t seem possible.

Kind regards

For example: this code doesn’t work :
import wixData from ‘wix-data’ ;
// …
wixData.query( ‘#customFeedWidget1’ ).ascending( “created” );

Why ?

Thanks a lot

Kind regards

Hey Camille,

If you’d like to get a list (i.e. an array) of all of your blog posts based on the order they were originally published, you can use the following query.

import wixData from 'wix-data';

    Name of the collection goes in the wixData.query('NAME_OF_COLLECTION') section.
    .then(results =>{
        console.log(results.items);//This will print the code to the console to give you a view of your blog posts in a Javaascript Array.

If you wanted to order them by oldest to newest first for most recent publish date (like when you go back and update a blog post and then click publish again), switch the field key in ascending to ‘lastPublishedDate’ instead.