Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Where to put Grav Breadcrumbs code?

plugins

Started by Tatiana Perry 8 years ago · 1 replies · 1603 views
8 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.

8 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 TomW, 2 weeks ago
8 228 9 hours ago
Support · by alex, 2 months ago
8 667 1 day ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 160 3 days ago
Support · by TomW, 6 days ago
2 106 6 days ago