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

  • #2537
    Avatar photo[anonymous]

    I’ve some sections in the homepage, each one has a number of posts by tags, but if one post have more than one tag, it appears on several sections.

    In order to avoid add an additional argument exclude_tags or main_tag on {{#getPostsByTags}} helper, i suggest create an {{#getPostsByMainTag}} helper.

    I think that if the pages-feature came to reality, this is no longer necessary.

    Avatar photo[anonymous]
    let themeHelpers = {
        getPostsByMainTag: function(mainTag, content) {
            const postsData = JSON.parse(JSON.stringify(;
            let filteredPosts = [];
            postsData.forEach(function(post) {
                post.mainTag.slug == mainTag && filteredPosts.push(content.fn(post));
            return filteredPosts.join();
    module.exports = themeHelpers;