How to add current page title in the breadcrumb?

Hi all,

By default, the breadcrumb displays only "parent" pages title. Is it possible to add it the current page title?

(For obvious usability reason, this last item (in the breadcrumb) will not be linked because it targets the current page.)

I've checked the 'breadcrumbs.vm' file but I can't locate where it dynamically builds the breadcrumb path.

 

Thanks in advance,

1 answer

1 accepted

0 vote
Stephen Deutsch Community Champion Apr 11, 2016

Instead of trying to modify the breadcrumbs.vm file, why not just do it with a bit of Javascript that you could put in the custom HTML?

AJS.toInit(function() {
  if (AJS.params.browsePageTreeMode == "view") {
    if (AJS.params.contentType == "page") {
      jQuery("#breadcrumbs").append('<li><span> ' + AJS.params.pageTitle + '</span></li>');
    } else if (AJS.params.contentType == "blogpost") {
      jQuery("#breadcrumbs").append('<li><span> ' + AJS.params.pageTitle.split('/').pop() + '</span></li>');
    }
  }
});

Thanks, it works perfectly.

What I was exactly looking for is this variable: AJS.params.pageTitle

Is there a specific documentation that provides all this kind of properties?

Stephen Deutsch Community Champion Apr 11, 2016

I wish there was...

You can check out what's in AJS.params by opening the browser console/developer tools on any Confluence page (usually pressing F12), go to the console tab, and type "AJS.params", and then it should list the contents.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

264 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you