The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

How to add current page title in the breadcrumb?

Nicolas Casel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 9, 2016

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 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>');
    }
  }
});
Nicolas Casel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 11, 2016

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 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.

TAGS
AUG Leaders

Atlassian Community Events