Order data in scully-routes.json

angularscully

In Scully, the scully-routes.json file lists all the routes that have been generated as static HTML files. By default, the routes are listed in the order that they were generated.

If you want to change the order of the routes in the scully-routes.json file, you can do so by modifying the order in which the routes are generated. For example, you can use the sortRoutesBy option in the scully.config.js file to specify a sorting function that determines the order in which the routes are generated.

Here’s an example of how you can use the sortRoutesBy option to sort the routes alphabetically by path:

module.exports = {
    sortRoutesBy: (a, b) => a.route.localeCompare(b.route),
    routes: {
        '/route1': {
            type: 'contentFolder',
            folder: './src/app/route1',
        },
        '/route2': {
            type: 'contentFolder',
            folder: './src/app/route2',
        },
    },
};

Alternatively, you can use the sortRoutesBy option to sort the routes by any other criteria, such as the date they were created or the title of the page.

Keep in mind that the order of the routes in the scully-routes.json file does not affect the order in which they are displayed on the website. To change the order in which the routes are displayed, you will need to modify the navigation structure of your website.