Back to Modular Theme with PAGE BUILDER - Clear Support

info36186
info36186

How to use a Blog block in some page, but show only posts from speficic category?

I am able to add a field to the editor, where the category should be defined (meta/blocks.yaml):

blog:
    name: Blog
    description: Blog
    icon: icon-file-text-o
    fields:
        ....
        section_blog_category:
            label: Category
            type: text
            span: right

I am able to access the property from the template (partials/blocks/blog.html):

[blogPosts]
pageNumber = "{{ :page }}"
categoryFilter = "XXXXX"
postsPerPage = 3
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "blog/blog-category"
postPage = "blog/blog-post"
==
{{ data.section_blog_category}}

but the categoryFilter shoul be defined in the template definition part (top of the file)

How to set the property to the categoryFilter of a blogPosts component?

I have tried couple of methods (something like dynamical :page, setting to component in onStart/onInit methods,...) but all of them failed for different reasons.

Thanks for help.

Last updated

1-1 of 1