Multiple Categories within FAQ page drop downs

Topic summary

Goal: implement multiple categories within a FAQ using accordion-style drop-downs (collapsible sections).

Current setup: two category buttons (CATEGORY ONE, CATEGORY TWO), each with a panel that loops over the same section.blocks to render Q&A items.

Template details: Liquid-style code uses {% for block in section.blocks %} twice. CATEGORY ONE outputs block.settings.question/answer; CATEGORY TWO outputs block.settings.question_two/answer_two.

Schema: defines two block types—“QA One” with fields question/answer and “QA Two” with fields question_two/answer_two—under one section. JavaScript toggles panel visibility by setting maxHeight on click.

Issue reported: the implementation “skips” a section (content not rendering as expected for one category). A screenshot is attached to illustrate the behavior.

Status: no resolutions or action items yet; the author is seeking guidance on how to properly structure multiple FAQ categories within the same section. Unanswered question: best practice to render distinct categories from shared blocks without skipping content.

Summarized with AI on March 4. AI used: gpt-5.

Anyone know of a way to create multiple categories within a FAQ section?

This is what I currently have but it “skips” a section.

CATEGORY ONE
{%for block in section.blocks%}
{{block.settings.question}}
{{block.settings.answer}}
{%endfor%}
CATEGORY TWO
{%for block in section.blocks%}
{{block.settings.question_two}}
{{block.settings.answer_two}}
{%endfor%}

{% schema %}
{
“name”: “FAQ SECTION”,
“settings”: ,
“blocks”: [
{
“type”:“text”,
“name”:“QA One”,
“settings”:[
{
“id”:“question”,
“type”:“text”,
“label”:“the question”
},
{
“id”:“answer”,
“type”:“richtext”,
“label”:“the answer”
}
]
},
{
“type”:“text”,
“name”:“QA Two”,
“settings”:[
{
“id”:“question_two”,
“type”:“text”,
“label”:“the question”
},
{
“id”:“answer_two”,
“type”:“richtext”,
“label”:“the answer”
}
]
}
]
}
{% endschema %}
{% javascript %}
var acc = document.getElementsByClassName(“accordion-faq”);
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener(“click”, function() {
this.classList.toggle(“active”);
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + “px”;
}
});
}
{% endjavascript %}