Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set page title in Confluence Blueprint plugin

I am working on Confluence Blueprint plugin to create blueprint with pre-define  page hierarchy. I am using hello-blueprint.git  as a reference.  I am able to create sample page hierarchy but unable to provide proper title to a page. 

Title of a parent page is coming in child page as well separated by -.  

In below screenshot child page title is highlighted. 

Please help me in populating the proper title.

Capture.PNG

 

i18n.properties

confluence.hierarchy.blueprint.content.template.name=Application Home Page
# The following properties are used in the Hierarchy Blueprint.
confluence.hierarchy.blueprint.name=Hierarchy Blueprint
confluence.hierarchy.blueprint.description=A Blueprint that creates child pages too
confluence.hierarchy.blueprint.content.home.title=Application Home Page
confluence.hierarchy.blueprint.content.application.title=Application
confluence.hierarchy.child.a.blueprint.name=Hierarchy Blueprint Child As
confluence.hierarchy.child.b.blueprint.name=Hierarchy Blueprint Child Bs
# TODO - best key for the name that becomes the page title? dT
confluence.application.content.template.name=application
confluence.architecture.content.template.name=architecture
confluence.capabilities.content.template.name=capabilities

HierarchyContextProvider.java

import com.atlassian.confluence.languages.LocaleManager;
import com.atlassian.confluence.plugins.createcontent.api.contextproviders.AbstractBlueprintContextProvider;
import com.atlassian.confluence.plugins.createcontent.api.contextproviders.BlueprintContext;
import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
import com.atlassian.confluence.util.i18n.I18NBean;
import com.atlassian.confluence.util.i18n.I18NBeanFactory;

import static com.atlassian.confluence.plugins.createcontent.actions.DefaultBlueprintContentGenerator.CONTENT_PAGE_TITLE_CONTEXT_KEY;

/**
* Provides content for the "Hierarchy" Blueprint and its two child pages.
*
* @since 1.6
*/
public class HierarchyContextProvider extends AbstractBlueprintContextProvider
{
private final LocaleManager localeManager;
private final I18NBeanFactory i18NBeanFactory;

public HierarchyContextProvider(LocaleManager localeManager, I18NBeanFactory i18NBeanFactory)
{
this.localeManager = localeManager;
this.i18NBeanFactory = i18NBeanFactory;

}

@Override
protected BlueprintContext updateBlueprintContext(BlueprintContext context)
{
String pageTitle = i18nBean().getText("confluence.hierarchy.blueprint.content.home.title");

// context.put(CONTENT_PAGE_TITLE_CONTEXT_KEY, pageTitle);
context.setTitle(pageTitle);

return context;
}

private I18NBean i18nBean()
{
return i18NBeanFactory.getI18NBean(localeManager.getLocale(AuthenticatedUserThreadLocal.getUser()));
}
}

 

atlassian-plugin.xml

<content-template key="hierarchy-blueprint-content-template"
i18n-name-key="confluence.hierarchy.blueprint.content.template.name">
<description key="confluence.hierarchy.blueprint.content.template.description"/>
<resource name="template" type="download"
location="com/atlassian/confluence/plugins/hello_blueprint/xml/hierarchy-content-template.xml"/>
<context-provider class="com.atlassian.confluence.plugins.hello_blueprint.HierarchyContextProvider"/>
</content-template>

<content-template key="hierarchy-application-template"
i18n-name-key="confluence.application.content.template.name">
<description key="confluence.application.content.template.description"/>
<resource name="template" type="download"
location="com/atlassian/confluence/plugins/hello_blueprint/xml/hierarchy-application-template.xml"/>
</content-template>

<content-template key="hierarchy-architecture-template"
i18n-name-key="confluence.architecture.content.template.name">
<description key="confluence.architecture.content.template.description"/>
<resource name="template" type="download"
location="com/atlassian/confluence/plugins/hello_blueprint/xml/hierarchy-architecture-template.xml"/>
</content-template>

<content-template key="hierarchy-capabilities-template"
i18n-name-key="confluence.capabilities.content.template.name">
<description key="confluence.capabilities.content.template.description"/>
<resource name="template" type="download"
location="com/atlassian/confluence/plugins/hello_blueprint/xml/hierarchy-capabilities-template.xml"/>
</content-template>

<web-item key="hello-space-blueprint-item" i18n-name-key="confluence.hello.space.blueprint.name" section="system.create.space.dialog/content">
<description key="confluence.hello.blueprint.description"/>
<resource name="icon" type="download" location="com/atlassian/confluence/plugins/hello_blueprint/images/preview.png"/>
<param name="blueprintKey" value="my-space-blueprint"/>
</web-item>

<space-blueprint key="my-space-blueprint" i18n-name-key="confluence.hello.space.blueprint.name">
<content-template ref="hierarchy-blueprint-content-template">
<content-template ref="hierarchy-application-template">
<content-template ref="hierarchy-architecture-template"/>
<content-template ref="hierarchy-capabilities-template"/>
</content-template>
</content-template>
<promoted-blueprints>
<blueprint ref="com.atlassian.confluence.plugins.hello-blueprint:hello-blueprint"/>
<blueprint ref="com.atlassian.confluence.plugins.hello-blueprint:view-result-blueprint"/>
</promoted-blueprints>
<!-- Needs to be a web-item, not a Blueprint. -->
<default-blueprint-item ref="view-result-blueprint-item"/>
<space-creation-steps>
<space-creation-step ref="com.atlassian.confluence.plugins.confluence-create-content-plugin:restrictedUserSpaceCreationStep"/>
<space-creation-step ref="com.atlassian.confluence.plugins.confluence-create-content-plugin:watchSpaceCreationStep"/>
</space-creation-steps>

<dialog-wizard key="my-space-blueprint-wizard">
<dialog-page id="spaceBasicDetailsId"
template-key="Confluence.Templates.Blueprints.CreateSpace.createSpaceForm"
title-key="confluence.hello.blueprint.dialog.choose.title"
description-header-key="confluence.hello.blueprint.dialog.choose.heading"
description-content-key="confluence.hello.blueprint.dialog.choose.description"/>
</dialog-wizard>
</space-blueprint>

<theme key="my-theme-key" name="Simple Space Theme" class="com.atlassian.confluence.themes.BasicTheme">
<description>A simple example theme for all</description>
<param name="includeClassicStyles" value="false"/>
<resource type="download" name="default-theme.css" location="/includes/css/default-theme.css">
<param name="source" value="webContext"/>
</resource>
</theme>

</atlassian-plugin>

 

2 answers

Hey Ravi,

 

I have the same problem. Have you found a solution for this problem?

Hi Have you found a solution? I'm standing in the same place and I can't find a way!

still no valid answer on this? I'm having the same issue here... :( 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,690 views 7 31
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you