Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Where to put Grav Breadcrumbs code?

plugins

Started by Tatiana Perry 7 years ago · 1 replies · 1339 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 Thomas, 1 week ago
3 101 8 hours ago
Support · by Anna, 3 days ago
2 98 1 day ago
Support · by Justin Young, 1 day ago
1 66 1 day ago
Support · by Duc , 1 week ago
2 101 6 days ago
Support · by Colin Hume, 1 week ago
2 94 6 days ago