Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Where to put Grav Breadcrumbs code?

plugins

Started by Tatiana Perry 7 years ago · 1 replies · 1507 views
7 years ago

I installed the grav breadcrumb plugin.
https://github.com/getgrav/grav-plugin-breadcrumbs

I realized it didn't work out the box as the README says. You need to include it. I want it on every page, not just blog pages. (default.md) I am trying to figure out where to add

TWIG
{% if config.plugins.breadcrumbs.enabled %}
    {% include 'partials/breadcrumbs.html.twig' %}
{% endif %}

/forum/archive/breadcrumbs-not-showing-t9111

I tried my partials/base.html.twig according to this post above but it's still not working. Does anyone know where this is supposed to go?
Using the base quark theme.

7 years ago

I solved it partially. The following forces it on every page which is okay. But I lose the ability to control the pages. Adding show_breadcrumbs to the if statement actually breaks it and the breadcrumbs stop showing.
After installing, copy this to the default.html.twig file

TWIG
{% extends 'partials/base.html.twig' %}

{% block content %}
    {% if config.plugins.breadcrumbs.enabled %}
        {% include 'partials/breadcrumbs.html.twig' %}
    {% endif %}
    {{ page.content|raw }}
{% endblock %}

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 7 days ago
4 153 6 days ago
Support · by nwhitfield, 1 week ago
2 134 1 week ago
Support · by stell, 3 weeks ago
5 369 2 weeks ago
Support · by gravinator, 1 month ago
5 559 2 weeks ago
Support · by Gravver, 3 weeks ago
6 347 3 weeks ago