The $structuredTopics
variable contains a JSON object with a representation of the document's structure.
It contains the following keys:
title
: the title of a topic.-
depth
: the table of content depth of a topic.1
is a root-level topic. -
htmlContent
: the HTML content of a topic. breadcrumb
: the parent topics of a topic.officialReaderUrl
: the URL of the topic on the portal.topicSourceType
: can beOFFICIAL
, orPERSONAL
for a topic written in a personal book.confidential
: can betrue
orfalse
. Istrue
when a topic belongs to a document for which the Add to personal book feature is disabled.originContentId
: The Content ID of the topic.originTocId
: When printing personal books only, the ToC ID value of the topic.originMapId
: When printing personal books only, the Document ID value of the parent document of the topic.
For example:
[
{
"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://doc.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL",
"confidential": false,
"originContentId": "OcFYGd01lcsA7VA3Fa4MMg",
"originTocId": "",
"originMapId": ""
},
{
"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://doc.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL"
}
],
"officialReaderUrl": "https://doc.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators/Maps",
"topicSourceType": "OFFICIAL",
"confidential": false,
"originContentId": "OcFYGd01lcsA7VA3Fa4MMg",
"originTocId": "",
"originMapId": ""
},
{
"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://doc.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators",
"topicSourceType": "OFFICIAL"
},
{
"title": "Maps",
"officialReaderUrl": "https://doc.fluidtopics.com/r/Fluid-Topics-API-Reference-Guide/Knowledge-Hub-web-services-for-administrators/Maps",
"topicSourceType": "OFFICIAL"
}
],
"officialReaderUrl": "https://doc.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": ""
}
]
The value of each htmlContent
key has been shortened to enhance readability.
Use case:
The $structuredTopics
variable allows for greater control on the layout of PDFs.
The following Velocity code sample uses the $structuredTopics
variable to:
- Create titles for each topic found in the
$structuredTopics
variable, 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)
<!-- Titles -->
#set ($depthClass = "pdf-header-lvl" + $structuredTopic.depth())
#if ($structuredTopic.depth() >= 1 && $structuredTopic.depth() <= 6)
<h$structuredTopic.depth() class="$depthClass">$structuredTopic.title()</h$structuredTopic.depth()>
#else
<h6 class="$depthClass">$structuredTopic.title()</h6>
#end
<!-- Breadcrumb -->
#if ($structuredTopic.breadcrumb().size() > 0)
<div class="breadcrumb">
<strong>Navigation</strong>:
#foreach ($item in $structuredTopic.breadcrumb())
<span>$item.title() /</span>
#end
<em>$structuredTopic.title()</em>
</div>
#end
<!-- Topic content -->
<p>$structuredTopic.htmlContent()</p>
#end
It has a breadcrumb
CSS class containing the following styles:
.breadcrumb {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
The previous code creates the following layout: