Page 1 of 1

Customizing WebHelp Responsive header

Posted: Wed Jan 09, 2019 7:51 pm
by Pascale
Hi,
we have a custom DITA map DTD, with additional metadata that we want to show in the header in a customized WebHelp Responsive plugin, as part of the title.
For example, we want to display the product name before and the document version after the title's text, and the entire string must be included in the link ('<a href=...>)' element.
Can you please explain how we can achieve this ?
Is there a parameter, an extension-point or an element of the publishing template that we can customize ?

Kind regards,
Pascale

Re: Customizing WebHelp Responsive header

Posted: Thu Jan 17, 2019 12:53 pm
by Pascale
Hi,
any idea on this ?
Would it help if I re-formulate my question as : how can I customize the <whc:webhelp_publication_title> component ?

Pascale

Re: Customizing WebHelp Responsive header

Posted: Fri Jan 18, 2019 4:14 pm
by alin
Hello,

You can retrieve metedata info from your input map using the macros template components: https://www.oxygenxml.com/doc/versions/ ... gment_file.

You can add content before and after the <whc:webhelp_publication_title> component by expanding it in the HTML Layout files as follows:

Code: Select all


<whc:webhelp_publication_title>
<!-- Content before component content -->

<whc:component_content/>

<!-- Content after component content -->
</whc:webhelp_publication_title>
This support is available for all whc:* template components.

Supposing you have the following metadata in your DITA map:

Code: Select all


<map>
<title>Growing Flowers</title>

<topicmeta>
<prodinfo>
<prodname>My product</prodname>
<vrmlist>
<vrm version="20.1"/>
</vrmlist>
</prodinfo>
</topicmeta>
.....
</map>
You can use the map-xpath macro to retireve the product name and the product version from the DITA map and insert these data before and after the publication title as follows:

Code: Select all



<whc:webhelp_publication_title>
<span class="wh_publication_title before-title">
<a href="${path(oxygen-webhelp-output-dir)}/index.html">
<span>[<whc:macro value="${map-xpath(/map/topicmeta/prodinfo[1]/prodname/text())}"/>]</span>
</a>
</span>

<whc:component_content/>

<span class="wh_publication_title after-title">
<a href="${path(oxygen-webhelp-output-dir)}/index.html">
<span>[v. <whc:macro value="${map-xpath(/map/topicmeta/prodinfo[1]/vrmlist/vrm[1]/@version)}"/>]</span>
</a>
</span>
</whc:webhelp_publication_title>
Note that you will obtain 3 <a> elements: one for the content before, one for the actual title and one for the content after the title.
You can customize the styles for the added content by providing additional CSS to the WebHelp Responsive transformation: https://www.oxygenxml.com/doc/versions/ ... h-css.html

Regards,
Alin

Re: Customizing WebHelp Responsive header

Posted: Tue Jan 22, 2019 5:35 pm
by Pascale
Thanks for your answer, however I need more details.

Do I need a "myCustomWebHelp" plugin or is it feasible simply by creating a new custom publishing template ?
In the later case, in which file should I add the code ?

TIA,
Pascale

Re: Customizing WebHelp Responsive header

Posted: Wed Jan 23, 2019 12:48 pm
by Costin
Hi Pascale,
Do I need a "myCustomWebHelp" plugin or is it feasible simply by creating a new custom publishing template ?
You do not need to create a custom plugin, you should just use Alin's suggestion in a publishing template.
In the later case, in which file should I add the code ?
In the "header.xml" file, located inside the "page-templates" folder from your custom publishing template folder. In order for the "page-templates" folder to be generated inside the exported publishing template, you should make sure you enable the "Include HTML Layout Files" option when exporting the publishing template from the transformation scenario configuration dialog.

More specific, that option is available in the "Save Template As..." dialog you obtain when saving (exporting) a publishing template, after you configured your transformation scenario.

I hope this helps.

Regards,
Costin