<p>It's tempting to use the Matrix block for things that might actually be better as a a channel or a structure.  I thing this might be the case here.</p>

<p>The way you've set it up is fine, relating each FAQ to a category is a good approach.</p>

<p>In any event, the plugin <code>groupBy</code> should help you:</p>

<p><a href="https://github.com/timkelty/groupby-craft" rel="nofollow">https://github.com/timkelty/groupby-craft</a></p>

<p>Or you can look at this example:</p>

<p><a href="http://craftcookbook.net/recipes/279" rel="nofollow">http://craftcookbook.net/recipes/279</a></p>

CC BY-SA 3.0
2015-11-22T16:47:24.860Z
Thanks. After your comment I'm now using a structure instead where each section (General, Payment..)  is now an entry rather than a category, and then I have the matrix inside each entry to add as many Q+A as required.  All gets outputted in my singles FAQ page.
sarah3585
CC BY-SA 3.0
2015-11-23T08:13:41.623Z
I just had another look at the `groupBy` plugin, but I can't figure out what it does in addition to Craft's `group` filter. @khalwat
carlcs
CC BY-SA 3.0
2015-11-23T08:20:26.940Z
See examples: http://craftcms.stackexchange.com/a/8665/125, http://craftcms.stackexchange.com/a/9959/125
carlcs
CC BY-SA 3.0
2015-11-22T15:48:29.363Z
2015-11-22T15:48:29.363Z
andrew.welch
<p>I'm setting up an FAQ page using a matrix. Each Matrix block contains a question and an answer field. Each Q+A needs to be outputted within a section on the same page such as General, Payments...</p>

<p>I've figured the best way to do this is using categories to assign the Q+As section, limiting each Q+A to one category. I'd then need to output all Q+As for each section with it's category as a header.</p>

<p>Desired Output:</p>

<pre><code>&lt;h2&gt;General&lt;/h2&gt;

&lt;p&gt;Question field output&lt;/p&gt;
&lt;p&gt;Answer field output&lt;/p&gt;

&lt;p&gt;Question field output&lt;/p&gt;
&lt;p&gt;Answer field output&lt;/p&gt;

&lt;h2&gt;Payments&lt;/h2&gt;

&lt;p&gt;Question field output&lt;/p&gt;
&lt;p&gt;Answer field output&lt;/p&gt;

....
</code></pre>

<p>I'm fairly new to craft so perhaps I'm overcomplicating it by assigning it to a category, it seems like it's the easiest way to add new Q+As and for them to appear within the right section.</p>

<p>How would I go about outputting this? I've set up a Category Group called 'faqCategories'</p>

<p>Here's my matrix setup:</p>

<p><a href="https://i.sstatic.net/EbpxX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EbpxX.png" alt="enter image description here"></a></p>

<matrix><categories><relations>
Output Matrix in relation to category
# Output Matrix in relation to category

(Asked by: username_0 on 2015-11-22)

I'm setting up an FAQ page using a matrix. Each Matrix block contains a question and an answer field. Each Q+A needs to be outputted within a section on the same page such as General, Payments...
I've figured the best way to do this is using categories to assign the Q+As section, limiting each Q+A to one category. I'd then need to output all Q+As for each section with it's category as a header.
Desired Output:
General

Question field output
Answer field output

Question field output
Answer field output

Payments

Question field output
Answer field output

....

I'm fairly new to craft so perhaps I'm overcomplicating it by assigning it to a category, it seems like it's the easiest way to add new Q+As and for them to appear within the right section.
How would I go about outputting this? I've set up a Category Group called 'faqCategories'
Here's my matrix setup:

**Tags:** matrix, categories, relations

---

## 1 answers

### Answer by username_1 on 2015-11-22. Score: 3 | Accepted answer

It's tempting to use the Matrix block for things that might actually be better as a a channel or a structure. I thing this might be the case here.

The way you've set it up is fine, relating each FAQ to a category is a good approach.

In any event, the plugin `groupBy` should help you:

<https://github.com/timkelty/groupby-craft>

Or you can look at this example:

<http://craftcookbook.net/recipes/279>

> **Comments:**
> **username_0**: Thanks. After your comment I'm now using a structure instead where each section (General, Payment..)  is now an entry rather than a category, and then I have the matrix inside each entry to add as many Q+A as required.  All gets outputted in my singles FAQ page.  
> **username_2**: I just had another look at the `groupBy` plugin, but I can't figure out what it does in addition to Craft's `group` filter. @khalwat  
> **username_2**: See examples: http://craftcms.stackexchange.com/a/8665/125, http://craftcms.stackexchange.com/a/9959/125  

---

