It does not look like it would be possible to break down the blog posts by those metrics that could be used in custom modules.
The filtering available for blog posts is:
blog_popular_posts (to show popular posts by time frame and/or tag)
blog_recent_posts (show most recent posts)
blog_recent_author_posts (show most recent posts by author)
blog_recent_tag_posts (show most recent posts by tag)
The only controls for most popular posts that you could build in the custom module would be allowing editor to select time frame (month, six months, year, all time) and select what tags to filter the posts by.
✔️ Did this post help answer your query? Help the community by marking it as a solution.
Hubl (Filter-Query) blogs by (Traffic Metrics, Content Metrics, Social Media Metrics)
SOLVE
Hi @CristianSabogal, * Here's how you can set up custom fields in the HubSpot Module Editor and use them in HubL to filter and display blog posts: You can add Custom Fields in the Module Editor,
example:
1. Blog (Blog Field): * Add a blog field named "blog" in the module editor.
2. Filter Type (Choice Field): * Add a dropdown field named "filter_by" in the module editor. * Example options: Recent Tag Posts, Popular, Recent Posts.
3. Tag Filter (Tag Field): * Add a tag field named "tag_field". * Enable repeater option in that field.
4. Number of Posts (Number Field): * Add a numeric field named "posts_limit".
* Use Fields in HubL Below is an example of HubL code that uses these module fields to fetch and display blog posts based on the selected filter: Example HubL Code with Inline Module Fields -
{% set filter_by = module.filter_by %} {% set posts_limit = module.posts_limit %} {% set blog = module.blog %} {% set tag_slugs = [] %} {% for item in module.tag_field %} {% set tag_slugs = tag_slugs.append(item.slug) %} {% endfor %} <div class="filtered-blog-list"> <!-- Fetch the blog posts based on filter type --> {% if filter_by == "tag_posts" %} <!-- Show the most recent tags posts --> {% set blog_posts = blog_recent_tag_posts(blog, tag_slugs, posts_limit, "AND") %} {% elif filter_by == "popular" %} <!-- Show the most popular posts --> {% set blog_posts = blog_popular_posts(blog, posts_limit, tag_slugs, "popular_past_month", "AND") %} {% elif filter_by == "recent" %} <!-- how the most recent posts --> {% set blog_posts = blog_recent_posts(blog, posts_limit) %} {% endif %} <!-- Render the filtered posts --> {% for post in blog_posts %}<div class="blog-post"> <h2><a href="{{ post.absolute_url }}"> {{ post.name }}</a></h2> <p>{{ post.publish_date }}</p> <p>{{ post.post_summary }}</p> </div>{% endfor %} </div>
This setup ensures that you can dynamically filter and display blog posts based on the module's custom fields.
It does not look like it would be possible to break down the blog posts by those metrics that could be used in custom modules.
The filtering available for blog posts is:
blog_popular_posts (to show popular posts by time frame and/or tag)
blog_recent_posts (show most recent posts)
blog_recent_author_posts (show most recent posts by author)
blog_recent_tag_posts (show most recent posts by tag)
The only controls for most popular posts that you could build in the custom module would be allowing editor to select time frame (month, six months, year, all time) and select what tags to filter the posts by.
✔️ Did this post help answer your query? Help the community by marking it as a solution.