Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Get posts by main tag

#2575
Avatar photo[anonymous]
let themeHelpers = {
    getPostsByMainTag: function(mainTag, content) {

        const postsData = JSON.parse(JSON.stringify(content.data.website.contentStructure.posts));

        let filteredPosts = [];

        postsData.forEach(function(post) {

            post.mainTag.slug == mainTag && filteredPosts.push(content.fn(post));
        });

        return filteredPosts.join();
    }
};
module.exports = themeHelpers;