List all posts from some blogs with a filter for each blog and allow editors to change the filter

Hi there,

I’m using a custom HTML template for listing all posts from all of the blogs.

The below is an example of how the template starts, based on the information found here Blog templates - HubSpot docs

 {% set all_posts = [] %}
 {% set press_posts = blog_recent_posts('1', 200) %}
 {% set blog_posts = blog_recent_posts('2', 200) %}
 {% set case_study_posts = blog_recent_posts('3', 200) %}
 {% set insight_posts = blog_recent_posts('4', 200) %}
 {% set research_posts = blog_recent_posts('5', 200) %}
 {% set video_posts = blog_recent_posts('6', 200) %}

And the filter looks like this:

<div class="col is-6 is-4-md">
 <span class="input-label">Filter by type:</span>
 <select id="js-type-filter" class="category-filter">
 <option value="all" selected="">Select type</option>
 <option value="type-press-releases">Press releases</option>
 <option value="type-blogs">Blogs</option>
 <option value="type-research">Research and Insights</option>
 <option value="type-video">Video</option>
 </select>
</div>

The template works just fine, but the issue is that no-one other than me can edit the filter.

I’m trying to figure out how to allow someone editing the listing page to change the options in the drop-down and for it to still work. I expect that this isn’t easily done without a workaround if it’s even possible. Does anyone have any ideas?
My idea is to use a custom module that would have a blog_id repeatable field and make it into something that would look a bit like this:

{% choice "blog_id" label='Choose the Blog ID', value='Text', choices='1, 2, 3, 4, 5', export_to_template_context=True %}

{% for choice in choices %}
{% set blog_name = blog_recent_posts(blog_id, 200) %}
---
<option value="{{ blog_id }}">Press releases</option>

But I can’t make the choice module editable from within the page editor.
Thanks

Hey @Hublasted

Fun stuff here!

Adding @piersg and @Kevin-C to this for their opinions.

Thanks @dennisedson

Hey @Hublasted

This shouldn’t be too terribly complex.

Though I am curious as to why you can’t get the choice field to be editable in the content manager.

Have you checked that you haven’t disabled editing in the content editor view via these options:

38949i2F812431E3B771EE.png

the prevent editing in content editor toggle, at the module evel

  1. the"is_available_for_new_content": true,​
  2. or the"global": false,​