Skip to content

Commit

Permalink
Blog global breadcrumbs (#11092)
Browse files Browse the repository at this point in the history
* Blog breadcrumbs fragment

* Add breadcrumbs to blog pages

* Fix typo

* Fix bug

* Better styling and a11y for breadcrumbs

* Lint
  • Loading branch information
jhonatan-lopes authored Sep 13, 2023
1 parent ccd18ed commit c6e06ca
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/pagemodels/blog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ def get_context(self, request):
context["related_posts"] = list(filter(None, related_posts))

# Pull this object specifically using the English page title
default_locale = Locale.objects.get(language_code=settings.LANGUAGE_CODE)
blog_page = BlogIndexPage.objects.get(title__iexact="Blog", locale=default_locale)
default_locale = Locale.get_default()
blog_page = BlogIndexPage.objects.filter(locale=default_locale).live().first()

if blog_page:
context["blog_index"] = blog_page
Expand Down
2 changes: 1 addition & 1 deletion network-api/networkapi/wagtailpages/pagemodels/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_context(self, request):
context = super().get_context(request)
context = get_page_tree_information(self, context)

# perform entry pagination and (optional) filterin
# perform entry pagination and (optional) filtering
entries = self.get_entries(context)
context["has_more"] = self.page_size < len(entries)
context["entries"] = entries[0 : self.page_size]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% block subcontent %}
<div class="tw-container small:tw-px-0">
<div class="tw-bg-white -tw-ml-8 small:tw-ml-0 -tw-mt-16 tw-pb-12 medium:tw-pb-16 large:tw-pb-24 tw-pl-8 small:tw-pr-8 tw-pt-8 medium:tw-pt-12 large:tw-pt-24 large:tw-px-12 tw-w-auto">
{% include "./fragments/blog_breadcrumbs.html" %}
<h1>
{% trans "Blog authors" %}
</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{% block index_header %}
<div class="tw-grid tw-grid-cols-12">
<div class="tw-col-span-12 large:tw-col-span-8 tw-mt-8">
{% if index_title %}
{% include "./fragments/blog_breadcrumbs.html" %}
{% endif %}
<h1 class="tw-h1-heading tw-mb-0 tw-mt-2 tw-pt-4">
{% if index_title %}{{ index_title }}{% elif root.title %}{{ root.title }}{% elif page.header %}{{ page.header }}{% else %}{{ page.title }}{% endif %}
</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{% load i18n %}

{% block index_header %}
<div>
<div class="tw-col-span-12 large:tw-col-span-8 tw-mt-8">
{% include "./fragments/blog_breadcrumbs.html" %}
<h1>{% trans "Search blog" context "Title of the blog search results page" %}</h1>
<form action="" method="get" class="my-4">
{% trans "Search all blog" context "Blog search bar" as placeholder_text %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% load wagtailcore_tags %}

<div class="tw-text-sm tw-text-gray-40">
<a class="tw-text-gray-40" href="{% pageurl page %}">{{ page.title }}</a>
<span aria-hidden="true" class="tw-mx-1"></span>
</div>

0 comments on commit c6e06ca

Please sign in to comment.