Get the current active category

Confluence User - 01 Apr, 2024

Hi. Is it possible to retrieve the current active category from menu sidebar? 


I know there is a hash variable to retrieve the list count of the UI menu, as displayed below, but it is static value and also is not used for what I want, which is to retrieving the current active category.

hashvariable;category;menu

2


02 Apr, 2024
confluenceUser
1
confluenceUser

i think you can get it using js / jquery.

looking at the html structure, the active menu item has the class "active" in it.


you can try writing a simple js selector like "$($('#category-container').find('li.active').find('span')[0]).text();" to target and extract the menu text

04 Apr, 2024
confluenceUser
confluenceUser

Alright thanks! We still need to access it through js/jquery then to get the active category. I was hoping to just retrieve it from the platform, like how hash variable works, but for not seems like js and jquery is need.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print