Problem/Motivation

  • The rigel_preprocess_breadcrumb() appends the page title to the end of the trail. In Drupal, breadcrumbs are cached based on the parent breadcrumb item.
  • So if the path is: Home / Parent 1 / Page title, the breadcrumb is cached from Home / Parent 1. Then if we go to another page that looks like Home / Parent 1 / Page title 2, since the caching happens at Parent 1, we'll see Home / Parent 1 / Page title instead of Home / Parent 1 / Page title 2
  • To get around this because we have Page title in the breadcrumb trail, we need to set the following $variables['#cache']['contexts'][] = 'url.path'; in rigel_preprocess_breadcrumb()
  • This changed happened in Drupal 8: https://www.drupal.org/node/2699627. To make sure we don't blow up the cache too much, we should only set the cache context if the page isn't a 404.

Issue fork rigel-3386029

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

baldwinlouie created an issue. See original summary.

baldwinlouie’s picture

Issue summary: View changes

baldwinlouie’s picture

Status: Active » Needs review

@yas, please review this patch.

yas’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

@baldwinlouie

Thank you for the issue. I'll merge the patch to 5.x and 6.x, and close this issue as Fixed.

  • yas committed 8a2b31a5 on 6.x authored by baldwinlouie
    Issue #3386029 by baldwinlouie, yas: Add caching by url.path to...

  • yas committed 0a1606f0 on 5.x authored by baldwinlouie
    Issue #3386029 by baldwinlouie, yas: Add caching by url.path to...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.