Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Where to put Grav Breadcrumbs code?

plugins

Started by Tatiana Perry 7 years ago · 1 replies · 1472 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 complanar, 6 days ago
6 150 22 hours ago
Support · by Rick Beebe, 6 days ago
2 106 3 days ago
Support · by blu3prince, 3 days ago
0 55 3 days ago
Support · by alex, 4 days ago
2 97 3 days ago
Support · by Marcel, 2 weeks ago
1 146 4 days ago