0

I want to show a faq page with links to articles, grouped by their taxonomy. How can I achieve this?

This is what I have so far:

        {{ taxonomy:faq_topics sort="title" }}
        <h2 class="mt-12  text-4xl font-bold hover:text-teal">
            <a href="{{ url }}">
                {{ title | title }}
            </a></h2>

        {{ collection:faq as="faq" taxonomy:faq_topics="{{slug}}" paginate="10"}}
            {{ faq }}
                <div class="mb-2">
                    <a href="{{ url }}" class="text-lg hover:text-teal tracking-tight leading-tight font-bold">
                        {{ title | widont }}
                    </a>
                </div>
            {{ /faq }}
        {{ /collection:faq }}

        {{ /taxonomy:faq_topics }}

But it does only show the titles with the taxonomies, but no articles are listed.

1 Answers1

0

Inside the {{ taxonomy:faq_topics }} loop, you have access to the related entries using the {{ entries }} loop which means you should be able to do something like this:

{{ taxonomy:faq_topics sort="title" }}
    <h2 class="mt-12  text-4xl font-bold hover:text-teal">
        <a href="{{ url }}">
            {{ title | title }}
        </a>
    </h2>

    {{ entries }}
        <div class="mb-2">
            <a href="{{ url }}" class="text-lg hover:text-teal tracking-tight leading-tight font-bold">
                {{ title | widont }}
            </a>
        </div>
    {{ /entries }}
{{ /taxonomy:faq_topics }}

I haven't tested this myself in a site but from a read of the documentation, I believe this should work.

Duncan McClean
  • 130
  • 2
  • 11