File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,12 @@ const default_options = {
286286
287287 count: 20 ,
288288
289+ // optional sorting function for the entries.
290+ // Gets the array entries as the input, expects the sorted array
291+ // as its output.
292+ // e.g.: sort: entries => _.reverse( _.sortBy( entries, 'date' ) ),
293+ sort : entries => entries,
294+
289295 // ---------------------------------------------------------------------------
290296
291297 // supported - use in config as needed
Original file line number Diff line number Diff line change @@ -226,6 +226,12 @@ PLUGIN.get_options_defaults = ( context ) =>
226226
227227 count : 20 ,
228228
229+ // optional sorting function for the entries.
230+ // Gets the array entries as the input, expects the sorted array
231+ // as its output.
232+ // e.g.: sort: entries => _.reverse( _.sortBy( entries, 'date' ) ),
233+ sort : entries => entries , // defaults to just returning it as it is
234+
229235 // -------------------------------------------------------------------------
230236
231237 // supported - use in config as needed
Original file line number Diff line number Diff line change @@ -84,9 +84,9 @@ class Generator
8484 {
8585
8686 try {
87-
88- const pages = this . pages . slice ( 0 , this . options . count ) ;
89-
87+
88+ const pages = this . options . sort ( this . pages ) . slice ( 0 , this . options . count ) ;
89+
9090 LIB . LOG . wait ( 'Adding pages/posts as feed items...' ) ;
9191
9292 const out = [ ] ;
You can’t perform that action at this time.
0 commit comments