We have Confluence Server 6.9.1
What do you mean by that? The page the macro is on? A page selected in the macro properties?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This will put the url on the page wherever you put the macro.
Macro Name:
page_url
Macro Title:
Page URL
Macro Body Processing:
No macro body
Template:
## @noparams $settingsManager.getGlobalSettings().getBaseUrl()$content.getUrlPath()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Davin. We want the macro to put the path in Confluence not the url, e.g.: Parent Page Title/Child Page Title/Child Page Title...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, got it. This should work.
Macro Name:
path_to_page
Macro Title:
Path to Page
Macro Body Processing:
No macro body
Template:
## @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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Works. Thank you! Is there a way to insert this path in the global footer, so we do it only once for all pages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to do it on a space by space basis you can go to Space tools -> Look and Feel -> Sidebar, header and footer you can put in wiki markup in the foot like such ...
{path_to_page}
Or if you want to do it on a global basis in Confluence Admin -> Look and Feel -> Layouts you can put the macro in the Page Layout decorator and it will show up on every page. FYI, this methods also can work on a space by space basis it is just a bit more complex than the above option. It is in Space tools -> Look and Feel -> Layout. Layout changes made in the space layout will override global layout changes.
Look for ...
<div id="main-content" class="wiki-content"> $body </div>
And change it to ...
<div id="main-content" class="wiki-content"> $body $helper.renderConfluenceMacro("{path_to_page}") </div>
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.
Dear @Davin Studer ,
Thank you a lot for the example!
If I understand right this macro provides breadcrumb only for created page.
Don't you know, is it possible to modify this macro to insert such path for linked article on Confluence. For example I create a new page on Confluence and want insert link (currenly there are three options: Display URL, Display as link, Display as card). So I think of which will allow to insert link and Display it as path (breadcrumb).
as example (let's say it is a confluence article) which I want refer to: https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/
And it would be great to get the following path in newly created article with path to another article "Insert links":
Thank you in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Davin Studer
I did not know, that macro is available only for stand alone version of Confluence. And I looked for such possibility but for Cloud version.
So I am sorry for disturbing you.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.