Skip to end of metadata
Go to start of metadata

Not really a Builder question this one, and quite embarassingly obvious I'm sure:

  • Is there a macro I can use to print the name of the current space?
  • (Related) is there a macro I can use to print the name of the current user?

TIA!

Simon

  • No labels

7 Comments

  1. Unknown User (gfraser)

    The builder-spacetitle macro will do the trick for the first one.

    As for the second one, if you use the menulink macro with the profile location then I think you can use the %user% token in the macro body, eg:

    {menulink:profile}%user%{menulink}
    

    Our online docs for menulink macro and compound-menuitem macro were recently updated to list all the tokens and where they can be used.

    1. Unknown User (simonwheatley)

      Thanks Guy. That's helped a lot, good to know about the compound-menuitem stuff.

      I can't get the tokens to work. My code is as below, can you see any issues?

      {compound-menuitem:activity|caption=Latest activity on %Space%|flat=true}
      {compound-menuitem:spaceadmin|caption=Admin %Space%|flat=true}
      
      1. Unknown User (gfraser)

        The captions only work on specific "locations" - the one for "activity" should work, but I don't think there is one for "spaceadmin". It might be worth adding a ticket to https://jira.adaptavist.com (in Builder project) to flag it for Alain's attention.

        1. if people can come up with a list of 'standard' replacements that should occur with every menulink then the source code is ready and willing to undertake this (wink)

  2. Unknown User (kichap)

    Is there a macro I can use to print the name of the current space key?

    1. {builder-spacetitle}

      Unknown macro: {builder-spacetitle}
      1. Unknown User (kichap)

        Thanks Alain,

        Unknown macro: {builder-spacetitle}

        gives only the space name and not the spacekey.

        I used

         {menuitem}{menulink:custom|link=http://localhost:8080/display/%spacekey%/Task Management}Task Management{menulink}{menuitem}
        

        in the theme to be generic across spaces.

        Is there any way to have global variables in themebuilder or confluence to store some values only to be used generically in the url links?