Get link of space home
Asked by wcms:

Hi there

Is there any way (for example a wiki markup) which will get me the the name and url to the home of the current space?

I'm asking this because we've modified the "Documentation Theme" in Administration -\> Look and Feel -\> Site Theme to show the Link to the Home of the wiki in the navigation. We just added a \[Home\].

Now, this works fine as long as nobody changes the title from Home to something else. Therefore it would be nice if there was some wiki markup which would get me the name and url of the space home. I tried \[spacekey:\] but this doesn't work unfortunately.

Thanks!


Answers:
author: CharlesH
body: A user macro will do the job nicely here. Take a look at this complete macro which does a lot more than you needneed. It will be quite simple to cut out the stuff you don't need though.

<http://blog.networkedcollaboration.com/2012/05/03/confluence-space-meta-data-user-macro/>

comments: author: wcms
body: Hey Charles

You're the man! This works great, I snipped everything out except for the getSpaceHome part, and it works. Only problem is, that it's displaying a home icon next to the item. Any idea how to get rid of that?

```
## @noparams## Get space details#set ( $spaceHome = $space.getHomePage() )## Display Space Details#contentLink2($spaceHome true false)
```


author: CharlesH
body: I experimented with the two boolean parameters for the function contentLink2. Here's the results:

true false - shows the home icon in front of the link

true true - shows the home icon in front of the link, and the space name in brackets after it

false false - shows just the link

false true - shows the link followed by the space name in brackets after it

So you need "false false".


author: wcms
body: You're awesome, thanks alot Charles :)


author: Daniel Borcherding
body: Hello,

It looks like you might be interested in one of the feature requests that I filed last week.

<https://jira.atlassian.com/browse/CONF-27737>

This feature would add support to link to the @\<location\> tags within confluence. You could just create a link to @home and jump back to the home of your space regardless of the name.

Please visit this issue and add your vote in the upper right hand corner.

comments: author: wcms
body: Hey Daniel

I did vote for the request, thanks for the tip. Does this mean there's no way to do this currently? Maybe I should try something with jQuery (like putting a placeholder into the Documentation-Theme, then get the current URL and reduce it to [https://domain.com/display/SPACEKEY](https://domain.com/display/SPACEKEY.) so I can replace the placeholder with it).

Thanks again!


author: Daniel Borcherding
body: There is no way that I am currently aware of that you are able to link to the home page of a site irrespective of name. If you are already using the Documentation theme you could enable the page tree macro to have Confluence render out the full page tree. You would then be able to use that macro to navigate back up to the home of the site. But I don't beleive there is a way to just create a single link that points at the home


author: CharlesH
body: A user macro will do the job nicely here. Take a look at this complete macro which does a lot more than you needneed. It will be quite simple to cut out the stuff you don't need though.

<http://blog.networkedcollaboration.com/2012/05/03/confluence-space-meta-data-user-macro/>


Tags: markup