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>

 

1 answer

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 30, 2018 in Confluence

How Manon Soubies-Camy uses Confluence + Trello to organize webinar notes and her knitting stash

@Manon Soubies-Camy is an engineer who has been an avid Atlassian user since 2014. She helps companies of all sizes transform the way they work with the Atlassian stack, including Jira and Confl...

855 views 8 13
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you