The $structuredTopics variable contains a representation of the document's structure, with one entry per topic.
It contains the following keys:
| Key | Type | Description |
|---|---|---|
tocId |
String | The topic's identifier based on its position in the table of contents. |
title |
String | The title of a topic. |
depth |
Number | The table of content depth of a topic. 1 is a root-level topic. |
htmlContent |
String | The HTML content of a topic. |
breadcrumb |
Array of objects | Contains the parent topics of a topic. |
title |
String | The title of a parent topic. |
officialReaderUrl |
String | The URL of a parent topic on the portal. |
topicSourceType |
String | Can be OFFICIAL, or PERSONAL for a topic written in a personal book. |
officialReaderUrl |
String | The URL of the topic on the portal. |
topicSourceType |
String | Can be OFFICIAL, or PERSONAL for a topic written in a personal book. |
confidential |
Boolean | true if a topic belongs to a document for which the Add to personal book feature is disabled. |
originContentId |
String | The Content ID of the topic. |
originTocId |
String | When printing personal books only, the ToC ID value of the topic. |
originMapId |
String | When printing personal books only, the Document ID value of the parent document of the topic. |
internalLinkAnchor |
String | The value of internalLinkAnchor is topic- + the tocId value. |
For example:
The following example illustrates the data structure as JSON. Each htmlContent value has been shortened for better readability.
[
{
"tocId": "r~M7cylaxJdW8w5DVxkoKA",
"title": "Knowledge Hub web services for administrators",
"depth": 1,
"htmlContent": "<p>This section describes web services with routes beginning as follows:</p>",
"breadcrumb": [],
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL",
"confidential": false,
"originContentId": "OcFYGd01lcsA7VA3Fa4MMg",
"originTocId": "",
"originMapId": ""
},
{
"tocId": "Kg8zt0Me7_ZoH0mFRIRqzw",
"title": "Maps",
"depth": 2,
"htmlContent": "<p>This section explains how to use Fluid Topics web services to manage a portal's maps (structured documents).</p>",
"breadcrumb": [
{
"title": "Knowledge Hub web services for administrators",
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL"
}
],
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators/Maps",
"topicSourceType": "OFFICIAL",
"confidential": false,
"originContentId": "OcFYGd01lcsA7VA3Fa4MMg",
"originTocId": "",
"originMapId": ""
},
{
"tocId": "fRCCR~VxPlNr2dHLjO~Cuw",
"title": "Delete a map attachment",
"depth": 3,
"htmlContent": "<p>This web service deletes an attachment from publications based on a metadata selection.</p>",
"breadcrumb": [
{
"title": "Knowledge Hub web services for administrators",
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL"
},
{
"title": "Maps",
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators/Maps",
"topicSourceType": "OFFICIAL"
}
],
"officialReaderUrl": "https://docs.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators/Maps/Delete-a-map-attachment",
"topicSourceType": "OFFICIAL",
"confidential": false,
"originContentId": "OcFYGd01lcsA7VA3Fa4MMg",
"originTocId": "",
"originMapId": ""
}
]
Use case:
The $structuredTopics variable allows for greater control on the layout of PDFs.
The following code sample uses the $structuredTopics variable to:
- Create titles for each topic found in the
$structuredTopicsvariable, taking into account the depth of the topic. - Create a breadcrumb below the title of topics, if the topic is not a top-level topic.
- Insert the content of the topic.
In this situation, the $structuredTopics variable replaces the $topics variable, adding a breadcrumb after the title of topics.
#foreach ($structuredTopic in $structuredTopics)
<article id="index-$foreach.count">
<!-- Title -->
#if ($structuredTopic.depth() >= 1 && $structuredTopic.depth() <= 6)
<h$structuredTopic.depth()>$structuredTopic.title()</h$structuredTopic.depth()>
#else
<h6>$structuredTopic.title()</h6>
#end
<!-- Breadcrumb -->
#if ($structuredTopic.breadcrumb().size() > 0)
<nav class="breadcrumb">
<strong>Navigation</strong>:
<ol>
#foreach ($item in $structuredTopic.breadcrumb())
<li>$item.title()</li>
#end
<li id="current_topic"><em>$structuredTopic.title()</em></li>
</ol>
</nav>
#end
<!-- Topic content -->
<section>
$structuredTopic.htmlContent()
</section>
</article>
#end
It has a breadcrumb CSS class containing the following styles:
.breadcrumb {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
padding: 0.5em 0;
margin: 0.5em 0 1em;
font-size: 0.9em;
}
.breadcrumb ol {
list-style: none;
padding: 0;
margin: 0;
display: inline;
}
.breadcrumb li {
display: inline;
}
.breadcrumb li:not(:first-child)::before {
content: " > ";
}
.breadcrumb li#current_topic {
font-style: italic;
color: #555;
}
The previous code creates the following layout: