I have apostrophe blog running on the server and under the lib/modules/apostrophe-blog-pages/views folder I have two templates index.html and show.html. And I have added a new template popular.html. Want I am trying to do it for the third template I want to restrict the value to 10 blog posts or articles. Where are in all other cases show all articles. I was able trace the code back to the apostrophe pieces pages file on line 42 where if no value is passed the value is default to 10. https://github.com/punkave/apostrophe/blob/master/lib/modules/apostrophe-pieces-pages/index.js
depending on the page now I want to change that value from 10 to 100 or back to 10. I code that I have under ./lib/modules/apostrophe-blog-pages/index.js is
module.exports = {
construct: function (self, options) {
self.pageBeforeSend = function (req, callback) {
function setPerPageValue() {
return new Promise(function (resolve, reject) {
if(req.originalUrl.indexOf("popular") !== -1) {
self.options.perPage = 10;
} else {
self.options.perPage = 100;
}
console.log("after",self.options.perPage);
resolve(req);
});
}
Promise.all([setPerPageValue()]).then(function (results) {
// All promises were resolved
return callback(null);
})
.catch(function (error) {
// One or more promises was rejected
return callback(error);
});
};
},
}
but the value always remains the same. For some reason the passed value once set is not changing? Any help will be appreciated.