Hello,
as the subject says, can we link to a confluence page using the path of that page (ie space/page/page/page) rather than what appears in the address bar?
Thanks.
In fact, i want a full path link to use from an external app with variables to define the link. Because as it is, i should perform the creation of a space for each environnement we use instead of creating subpages as we want to do. (Perhaps it's a solution...)
But if you have another solution with tags or anchors, i take it.
Ok, well that's nonsense, the url is what you want in the external link, not space and page names.
You could code your application to understand and replicate Confluence page urls given the space and page name though - the urls are created from base url + page-area + space key + page name (assuming you're using a page title that does not have unusual characters in it). If you code for that, your application will be able to work out the link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, great.
I didn't mention the breadcrumbs before - they're not actually there, there is no structure for them in Confluence pages, each space just contains a pile of uniquely named pages. Hence, they are not part of the url for a page either. The page tree is built separately in a pile of functions that effectively builds an index and then shows it to us in various ways in the UI.
That actually makes your code a bit more simple - you don't need to worry about the tree/breadcrumbs/container stuff. It's just "page X in space Y in Confluence Z"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm a bit confused. You want to link a page within confluence using "breadcrumbs", or you want a full link path? And what is it about the space creation?
What exactly you want to achieve?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i'd love to make an url with the tree structure to adress confluence page from another app which uses this same structure.
But it is simpler like it exists in case of space change. I will do with space name and page name.
Thanks for your concern.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
PS: i'm a relatively newbie in using confluence and a simple user, not admin (it limits possibilities). So i'm not very used to confluence "thinking".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Expanding on previous Macro made by @mykhailo m
BreadCrumb UserMacro - For use on Confluence DC
## Macro Name: breadcrumbles
## Macro Title: BreadCrumbles
## Description: Creates Breadcrumb for current page
## Category: Administration
## Macro Body Processing: No Macro Body
##Template: ----begin code
## @noparams
#set($breadcrumbsAsHtml ='')
#set($currentPageID = $content.id)
#getBreadcrumbs($content.id)
<div class='BreadCrumbles'>$breadcrumbsAsHtml</div>
##recursive macro to get the path to page breadcrumbs
#macro( getBreadcrumbs $contentID )
#set($thePage = $pageManager.getPage($contentID))
#if($contentID == $currentPageID)
#if($thePage.getParent())
#set($breadcrumbsAsHtml = "<span class='BCtoggle' title='Click to View Full Breadcrumb Path'>...</span><span style='bold'>" + $thePage.getTitle() + "</span>" + $breadcrumbsAsHtml )
#else
##Ignore if this page is the home page
#end
#else
#set($breadcrumbsAsHtml = "<a href='"+$thePage.getUrlPath()+"'>" + $thePage.getTitle()+ "</a>" + $breadcrumbsAsHtml )
#end
## Does this iteration have a parent?
#if($thePage.getParent())
#set($breadcrumbsAsHtml = $breadcrumbsAsHtml)
## Get parent of this iteration
#getBreadcrumbs($thePage.getParent().getContentId().asLong())
#end
#end
<style>
.BreadCrumbles a:not(:first-child) {display:none;}
.BreadCrumbles a {position:relative}
.BreadCrumbles a:after {
content:' \\ ';
}
.BreadCrumbles .BCtoggle {
font-size: 22px;
font-weight: bold;
line-height: 6px;
padding: 0px 4px;
background: #fff;
display: inline-block;
vertical-align: middle;
height: 18px;
border-radius: 6px;
margin: 0 6px;
border: 2px solid #ccc;
cursor:pointer;
transition:all .3s ease-in-out;
}
.BreadCrumbles .BCtoggle:hover{
background:#e0e0e0;
}
.BreadCrumbles .BCtoggle.closeBC {
line-height: 16px;
font-family: monospace;
}
</style>
<script>
AJS.toInit(function(){
AJS.$('.BreadCrumbles .BCtoggle').click(function(){
AJS.$('.BreadCrumbles a:not(:first-child)').toggle();
AJS.$(this).text(AJS.$(this).text() == '...' ? ' < ' : '...');
AJS.$(this).toggleClass('closeBC');
});
});
</script>
##Template: ----End code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I created request for feature (for Cloud Confluence), but as I understand, unfortunately, we will wait for it for ages...
https://jira.atlassian.com/browse/CONFCLOUD-72601
If that is what you have expected, then you may vote for this feature...
If you need it for Stand alone version, you may have a look on macro, but I think it has to be modified... to provided breadcrumbs link for linked page.
## @noparams #set($breadcrumbs = "") #set($breadcrumbSeperator = " / ") #getBreadcrumbs($content.id) $breadcrumbs ##recursive macro to get the path to page breadcrumbs #macro( getBreadcrumbs $contentID ) #set($thePage = $pageManager.getPage($contentID)) #set($breadcrumbs = $thePage.getTitle() + $breadcrumbs) ## Does this iteration have a parent? #if($thePage.getParent()) #set($breadcrumbs = $breadcrumbSeperator + $breadcrumbs) ## Get parent of this iteration #getBreadcrumbs($thePage.getParent().getContentId().asLong()) #end #end
Best wishes,
Mykhailo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you.
I voted !
I looked in macros, but it seems too time consuming for me to learn it and install the sdk.
Another thanks for this macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, when you're writing, use the link function (shortcut is a square bracket on server) - it'll ask you for a space and a page name. (The space is optional, it assumes "the current space" if you don't specify one)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.