Child links in tiles

syed
Posts: 56
Joined: Tue Nov 14, 2017 8:34 pm

Child links in tiles

Post by syed » Tue May 12, 2020 1:52 pm

Hi,

In the tiles view, the navtitle of the topicref shows up fine. I would like to include some child links inside each tile. Is there a way to do it? I tried using the topicmeta > data tags, but the content in the data tag is not displayed in the output. If a shortdesc is entered, it is correctly displayed.

Thanks...
Syed

alin
Site Admin
Posts: 161
Joined: Thu Dec 24, 2009 11:21 am

Re: Child links in tiles

Post by alin » Wed May 13, 2020 5:41 pm

Hi Syed,

By design the tiles component contains only entries for the first level topics. If you want to customize it in order to display the child topics you have to contribute an XSLT extension file that overrides the built-in template that generates each tile.
You can use the following XSLT snippet as starting point:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0"
    xmlns:whc="http://www.oxygenxml.com/webhelp/components"
    xmlns:toc="http://www.oxygenxml.com/ns/webhelp/toc"
    >
    <xsl:template match="toc:topic" mode="create-tiles">
        <xsl:param name="tileTemplate"/>
        <div class="tile-container">
            <xsl:next-match>
                <xsl:with-param name="tileTemplate" select="$tileTemplate"/>
            </xsl:next-match>
            <xsl:apply-templates select="toc:topic" mode="#current">
                <xsl:with-param name="tileTemplate" select="$tileTemplate"/>
            </xsl:apply-templates>
        </div>
    </xsl:template>
    
</xsl:stylesheet>


You should register your XSLT file on the "com.oxygenxml.webhelp.xsl.createMainPage" extension point in your Publishing Template's descriptor file.

Code: Select all

<xslt>
      <extension file="xsl/whc-tiles-customization.xsl" id="com.oxygenxml.webhelp.xsl.createMainPage"/>
</xslt>
Please note that the above XSLT snippet alters the original structure of the Tiles component and the default CSS styles might not match the new structure. You need to provide your own CSS styles to customize the layout of each tile.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply