Skip to content

Instantly share code, notes, and snippets.

View ismayil-ismayilov's full-sized avatar

Ismayil Ismayilov ismayil-ismayilov

View GitHub Profile
@ismayil-ismayilov
ismayil-ismayilov / breadcrumb.jinja
Created June 19, 2024 16:52 — forked from VincentLoy/breadcrumb.jinja
Easy snippet to get breadcrumb in a Wagtail page
<div class="breadcrumb-content">
{% if self.get_ancestors|length > 1 %}
<ul class="breadcrumb">
{% for p in self.get_ancestors %}
{% if p.is_root == False %}
<li><a href="{{ p.url }}">{{ p.title }}</a></li>
{% endif %}
{% endfor %}
<li class="active">{{ self.title }}</li>
class CategoryPage(Page):
parent_page_types = ["CoreApp.HomePage"] <- Notice that it is child of Homepage. So breadcrumb in this page is Homepage>CategoryPage
template = "category.html"
description = RichTextField(
null=True,
blank=True,
features=["bold", "italic", "link"],
)