Hi! I installed Adaptive Theme on a Drupal 8 site I've been using for testing purposes. I used the theme generator to create a subtheme and the only thing I've really added is a node and a view. However, I noticed that neither page will display breadcrumbs. I've checked to make sure the breadcrumb block is enabled in the Content Prefix region and I have reinstalled the theme and created another subtheme with the generator, but still no changes.

I did notice, through inspecting the page, that the block html is showing on these pages, but without displaying any content. Otherwise, I'm not sure what could be causing this issue to occur.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tklepsch created an issue. See original summary.

tklepsch’s picture

Title: Breadcrumbs are not being display on clean D8 install » Breadcrumbs are not being displayed on new D8 site
Jeff Burnz’s picture

Category: Bug report » Support request

I think this is a support request, maybe there are no actual breadcrumbs to display, e.g. you don't get a "Home > My Node" type breadcrumb in Drupal, or for a View, such as "Home > My View".

The block code will print (the wrappers) because of this issue: #953034: [meta] Themes improperly check renderable arrays when determining visibility

I am working on a JavaScript solution for layout so we can remove the empty block and region code etc, and set the layout in JS, however that solution is a little slow and creates some flicker as the layout is applied as a behaviour so has to wait until the whole document is loaded.

If you turn on the Forum module and visit it's links, create a forum topic etc, you should see breadcrumbs, the other way to test is to set your theme as the admin theme for a minute and surf around the admin pages, you should see breadcrumbs.

tklepsch’s picture

That is true, a support request would make sense in this situation unless proven to be a bug.

When I enabled the forum module, the breadcrumbs did appear on forum pages and with the markup override: Show the "You are here" label if it is enabled. Although it still doesn't work with other content types.

I changed the theme to Bartik, Stark and Seven, and each would show Home in the breadcrumb on the node and the view. Does Adaptive theme just by default not show Home?

Also, another point to note is when I enable the Adaptive Theme markup override: Show the "You are here" label, that text does not appear as well.

Jeff Burnz’s picture

Home is hidden by default, however you can turn it on in markup overrides.

Clear the cache if things don't appear strait away, this applies to nearly everything in theme settings, if it doesn't show up strait away, try clearing the cache. The "You are here" is simply hidden in the template and is a very simple TRUE/FALSE condition, to not display is most certainly because all twig templates are cached and you must clear cache to update them.

tklepsch’s picture

I have been clearing the cache every time I've made changes within the theme settings, but still nothing shows up. Same when enabling markup overrides, as mentioned previously. The breadcrumb mark up overrides do not work. And this seems to be a specific issue to adaptive theme, not the base themes.

la_gnf_1’s picture

I am having this same issue. Breadcrumbs are not showing up in my development site, not even the 'Your are here' label shows. Doing 'view source' on the page shows that the block div is there, but it is empty.

Jeff Burnz’s picture

Component: Layouts » Extensions
Status: Active » Postponed (maintainer needs more info)

It's most likely empty because there are no breadcrumbs. You need to clear the cache if you make a change and it doesn't show up, I might change this to clear the cache by default when you save the theme settings, however this can be a bit slow.

If you think there is genuinely an issue can you give more info, such as the URL you are visiting etc, to test I must be able to replicate exactly what you are doing.

Richard Buchanan’s picture

FileSize
73.65 KB
82.28 KB

I can confirm this is happening when there are breadcrumbs. I set up a local site, standard Drupal installation, no additional modules. I then generated a new subtheme and confirmed the breadcrumbs should display in the content prefix region in block layout. I cleared all cache at admin/development/performance with the subtheme as the default theme, no breadcrumbs appear. I switched the theme back to seven and reloaded admin/development/performance, breadcrumbs appear.

Richard Buchanan’s picture

Looks like {% content_prefix.has_regions %} is returning false in page.html.twig. Moving the breadcrumb block to a different region doesn't change the result.

Jeff Burnz’s picture

Category: Support request » Bug report
Status: Postponed (maintainer needs more info) » Active

I'm on it, will test shortly, @Richard Buchanan thanks for the screenshots, much appreciated.

Jeff Burnz’s picture

@Richard Buchanan what version of Drupal are you running? Is it 8.0.2 or a dev version? Also what version of Adaptivetheme - GIT or a dev. Strait off I can't replicate it (I get breadcrumbs), is there anything else you can add so I can try to replicate?

la_gnf_1’s picture

I don’t know if this will help anyone else but here is what I found after posting above then digging a little more. In my case I found my expectations of what the breadcrumbs should do were incorrect.

On a page one level down (mysite.com/page-1) I expected the breadcrumbs to show ‘home > Page 1’. Instead there were no breadcrumbs showing. At two levels down (mysite.com/page-1/page-2) breadcrumbs showed as ‘home > Page 1 > Page 2’ which is what I expected.

at_core.theme has code (line 880 – ‘//If home is the only item, remove it’) that is removing the home link. When I comment out that section of code and run the site, the breadcrumbs behave as I expected/wanted.

Richard Buchanan’s picture

@Jeff Burnz Drupal 8.0.2/AdaptiveTheme 8.x-1.x-dev. I used Drush to download AdaptiveTheme, but I can try Git. I'll let you know my results soon. Thanks

Richard Buchanan’s picture

Using Git branch 8.x-1.x, I still had no luck. If I turn on the block title display, I do get the block title. But still no breadcrumbs. I will try now on a brand new Drupal install just to make sure there isn't something else I did before that is going on. The current install is a few weeks old, set up for theme development.

Richard Buchanan’s picture

Okay, breadcrumbs are now displaying on a clean Drupal install.

Drupal 8.0.2
AdaptiveTheme 8.x-1.x (via git)

Not sure what was going on the first time around, but it is definitely not an issue with the theme.

Jeff Burnz’s picture

Status: Active » Fixed

@la_gnf_1 you don't need to comment the code to show the Home link, just check the option to show home in Extensions > Markup Overrides > Breadcrumbs

@Richard Buchanan thanks for the feedback, I'm not sure what is going on either - I haven't changed anything recently, a while back I did make the breadcrumbs (and pager) responsive (they change display to stacked if they're too wide for their container). However I'm not sure that would cause the problems you've had.

I'll mark this as fixed for now, if anyone has a problem feel free to re-open it.

Status: Fixed » Closed (fixed)

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

PatrickMichael’s picture

Hi all,
Thanks for a great theme.
I am getting the same issue as reported above.
Drupal 8.1.0 and Adaptive theme 8.x-1.x-dev (2016-Apr-25)
This page you will see the breadcrumb block title, but no breadcrumbs :: http://dev.digitalsolace.co.za/content/home-page-leader-0
Breadcrumb settings are enabled in markup overrides
Any help most appreciated

PatrickMichael’s picture

Additional information to the above:
Breadcrumbs show on http://dev.digitalsolace.co.za/node/6 (without the page title) but not on the url alias path http://dev.digitalsolace.co.za/content/home-page-leader-0

Richard Buchanan’s picture

@PatrickMichael, I'm getting a 404 on the aliased path link you gave.

@Jeff Burnz, which branches of Drupal and Adaptive theme do you prefer us to test against? Breadcrumbs are showing up on my site with aliased paths, but I can test on my local machine as well.

PatrickMichael’s picture

Apologies, i re-built the path aliases : http://dev.digitalsolace.co.za/content/home-page-leader is now correct.
I use the downloads from drupal.org , not the GIT branches.

PatrickMichael’s picture

Not sure if this is relevant, but the site started as a drupal 8.0.4 install and was upgraded to 8.1.0

Richard Buchanan’s picture

@PatrickMichael, Jeff updated the dev branch today, so I cannot go back and pull from the date you downloaded from. I can test this on my local machine, but it will be with today's dev update. Perhaps you can try updating as well?

PatrickMichael’s picture

@Richard Buchanan, thank you, yes i updated to the latest dev earlier today, no change. This is most confusing as if i enable one of the default themes, breadcrumbs show. I also have pathauto installed.

Richard Buchanan’s picture

I began with a fresh install of Drupal and couldn't reproduce your results Patrick. But I didn't get a crumb trail at all, path aliased or not. The block title is shown, but there is no block content.

Now if I make the at sub-theme for the admin theme and edit the node, the breadcrumb is as expected.

@Jeff Burnz, starting at line 902 of at_core.theme:

// If home is the only item, remove it.
$arr_length = count($variables['breadcrumb']);
if ($arr_length == 1 && $variables['breadcrumb'][0]['url'] == base_path()) {
  unset($variables['breadcrumb'][0]);
}

...shouldn't we be checking the theme setting theme_get_setting('settings_breadcrumb_home') instead of $arr_length ==1? In fact, I don't see that setting being checked anywhere.

Here's a quick patch that gives me the results I'd expect.

Richard Buchanan’s picture

Oops, a little more touchup.

PatrickMichael’s picture

@Richard Buchanan, thank you, this worked for me, most appreciated. Now working on adding the page title to the breadcrumb....

Richard Buchanan’s picture

Status: Closed (fixed) » Needs review

You're welcome Patrick, I updated the status to needs review to wait on feedback.

But if you're having issues with the current page title not showing when set in the theme settings, you'll want to open a new issue.

PatrickMichael’s picture

That's just it, I don't see the display page title as an option in Adaptive D8 theme settings, i know it is there in D7 - unless i am missing something!

Richard Buchanan’s picture

You know, you're right Patrick. Sorry, was thinking of AT 7.x, which had a setting for appending the page title to the breadcrumb trail.

Still best to create an issue under the "Feature request" category. It will need different logic than this issue presents, and will attract better attention on its own. Especially since it isn't a feature provided by AT 8.x at the time.

PatrickMichael’s picture

Yes, understood, thanks once again for all the help.

Jeff Burnz’s picture

Status: Needs review » Needs work
  1. +++ b/at_core/at_core.theme
    @@ -899,9 +899,8 @@ function at_core_preprocess_breadcrumb(&$variables) {
    -  $arr_length = count($variables['breadcrumb']);
    

    This is a feature of the theme - to remove the home link when it's the only item. I agree this could be made configurable, but I wonder how many people want to show the home link when it's the only item? I'm open for discussion on this.

  2. +++ b/at_core/at_core.theme
    @@ -899,9 +899,8 @@ function at_core_preprocess_breadcrumb(&$variables) {
    +  if (theme_get_setting('settings_breadcrumb_home') && $variables['breadcrumb'][0]['url'] == base_path()) {
    

    We do check the home setting using config, in the block of code below, around line 928 (see below) I never use theme_get_setting() in preprocess because it's slow, it's faster to use configuration, i.e. you will see in most functions I grab the settings config object: $config = \Drupal::config($theme . '.settings')->get('settings');

          // Show or hide the Home link.
          if (isset($config['breadcrumb_home']) && $config['breadcrumb_home'] === 1) {
            $first_item = array_values($variables['breadcrumb'])[0];
            if (isset($first_item['url']) && $first_item['url'] == base_path()) {
              array_shift($variables['breadcrumb']);
            }
          }
Jeff Burnz’s picture

I'm a tad confused about how to reproduce the bugs being discussed.

Could you guys give me simple steps to reproduce your error, e.g. install pathauto, then do this etc.

Cheers :)

Richard Buchanan’s picture

Thanks Jeff, I didn't look beyond around line 902 where home is removed when it's the only crumb.

If I'm viewing a node, I expect to see the home link in the breadcrumb since I hadn't set the setting to hide it. There's not always a case where I provide a home link in the main menu, so it's nice to have home in the crumb.

Here's how to reproduce it:

  1. Fresh install of Drupal 8
  2. Generate an at sub-theme
  3. Create a node and view it
  4. The breadcrumb should display the home link

The confusion is coming from #4, since the theme setting simply says "Remove the home link". Since the setting is not set some would expect to still see the home link, even though it's the only crumb.

Hopefully I didn't confuse things more, but I guess we didn't expect the home link to be removed if it's the only crumb.

Jeff Burnz’s picture

Assigned: Unassigned » Jeff Burnz

@Richard Buchanan ah, OK, I get it now.

I'll have to alter the theme settings for this, I should NOT hide the home link auto-magically and instead provide a new optional setting to hide Home if it's the only link.

Sound slike I need to clean up the descriptions also so it's not confusing about what is being removed/hidden etc.

Richard Buchanan’s picture

Thanks Jeff, that sounds like a good option to add! Going back now, wasn't so much a bug as it was a feature request. Haha

Jeff Burnz’s picture

Well, bug/feature request it kinda depends how you see it. If the behaviour is very unexpected and unwanted it can be a bug. I knew it would be controversial when I did it, but you have to try things. I frequently code in easter eggs like this and to be frank about 90% of them go unnoticed - because it's just a sensible/preferred way of doing things for 90% of people. I can concede on this one I have got it wrong.

  • Jeff Burnz committed f508c57 on 8.x-1.x
    Issue #2638880 by Richard Buchanan: Breadcrumbs are not being displayed...
Jeff Burnz’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

giambae’s picture

I am having same issue with Drupal core 8.8.5... I am unable to figure out how to fix it / I am not a code-er so would need some help please