diblas

Open full view…

Bootstrap Accordion component for Grav CMS

Sun, 18 Sep 2016 18:45:49 GMT

hnaparst
Sun, 18 Sep 2016 18:45:49 GMT

I am really not getting too far. When I include the twig include command in my default.html.twig, I get an error: --- A template that extends another one cannot have a body in "default.html.twig" at line 3. --- When I try to wrap that include statement in a twig block, the error goes away, but it does not render correctly. Any hints?

someguyfromnowhere
Sat, 05 Nov 2016 20:09:33 GMT

Is there some way to make the accordion component go full width?

hnaparst
Sat, 05 Nov 2016 20:44:09 GMT

I ended up using [UIKit](https://getuikit.com/docs/accordion.html) instead of Bootstrap. --- $ cat faq.html.twig {% extends 'partials/base.html.twig' %} {% block content %} {{ content }} <div class="uk-accordion" data-uk-accordion> {% for faq in page.header.faq %} <h3 class="uk-accordion-title">{{ faq.question }}</h3> <div class="uk-accordion-content">{{ faq.answer }}</div> {% endfor %} </div> {% endblock %} --- then --- cat pages/08.FAQ/faq.md three dashes title: FAQ faq: - question: Why ? answer: Why not. - question: When? answer: Now. - question: How? answer: Contact us. three dashes ## FAQ ---