/**
*
* Helper that filters out posts with a certain tag from the list
*
* @param {Array} posts
* @param {String} slug
* @returns {Array}
*/
module.exports = function filterPostsByTagSlug(posts, slug, options) {
if (!slug) {
return posts;
}
let newPosts = [];
let found = false;
for (var post of posts) {
for (var tag of post.tags) {
if (tag.slug === slug) {
found = true;
break;
}
}
if(!found){
newPosts.push(post);
}
else{
found = false;
}
}
return newPosts;
};
I actually wanted an infinity scroll instead of pagination but that’s a whole new topic… i can i fix the pagination here?
Infinite scroll? Any time you can keep scrolling and scrolling, and more posts load. Headline does it, for example, on the tags pages. Casper does it on pretty much any page.