Page 1 of 1

Use navtitle for topic title

Posted: Thu Feb 07, 2019 3:15 pm
by axhxu
Hi,
Just wondering if there is an easy way to grab the topics navtitle from that map and use that in the topics heading.

It works for the toc. I need the toc heading and the topic heading to match.

Thanks
Arron

Re: Use navtitle for topic title

Posted: Fri Feb 08, 2019 4:09 pm
by Radu
Hi Aaron,

The navtitle is only used in the table of contents and when links are made to the topic. So by default it does not override the actual title presented when the HTML topic is opened.
There may be a way to achieve what you want. Let's say in the DITA Map you have a topic reference looking like this:

Code: Select all

> <topicref href="topics/introduction.dita" locktitle="yes">
<topicmeta>
<navtitle>ABCDEF</navtitle>
</topicmeta>
</topicref>
If you publish the DITA Map to plain HTML5 or XHTML output and you set the "clean.temp" parameter to "no", in the transformation temporary files folder the topic's content will look something like this:

Code: Select all

<topic..........>
<title............>Original Title</title>
<titlealts class="- topic/titlealts ">
<navtitle>ABCDEF</navtitle>
</titlealts>
so when the XSLT stylesheets which produce the HTML output are applied over the topic they have this information in the topic file.

For example for HTML5-based outputs this XSLT stylesheet:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT3.x/plugins/org.dita.html5/xsl/topic.xsl

has this XSLT template:

Code: Select all

<xsl:template match="*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/title ')]">
which could also look at the titlealts/navtitle when deciding the <h1> content.

Regards,
Radu