Link Content - Fluid Topics - 3.8 - Technical Notes

Develop Connectors with the Fluid Topics API

Product
Fluid Topics
FT_Version
3.8
Category
Technical Notes
language
English
audience
public

Once documents have a unique and stable ID and once the app potentially clusters them, then it is possible to create one of the following types of links:

Link to another topic in the same document

The following examples show how to generate a link to another topic in the same document:

  • Use <a href="contentId">mylink</a> where contentId is the content identifier.

    OR

  • Use <a href="topic_baseId" data-ft-link-type="baseId">my link</a> where topic_baseId is the topic's base_id.

When no base_id is provided for a document or topic, Fluid Topics uses its ID (document_id or content_id) as fallback value.

Link to another topic in a different document (i.e. cross-document links)

The following example show how to generate a link to another topic contained in a different document:

  • Use <a href="topic_baseId" data-ft-link-type="baseId">my link</a>.

Link to a resource

The following example shows how to include a resource in the document (image, zip file, and so on):

  • Put the resource ID in the HTML source field as follows:
    • <img src="resourceId">
    • <object data="resourceId">
    • ...

The following line shows how to include a link to a resource in the Viewer page (PDF, image, and so on):

  • Use <a href="id">my link</a>.
  • Or <img src="imageId"/> directly for an image.

Link to an external content

The following line show how to generate a link to an external site:

  • Use <a href="https://mysite.com/mypage.html">my link</a>.

All absolute links (beginning with "https://" "http://", "ftp://", ...) are considered to be external links.

The following lines show an example of links used in Topics objects:

from fluidtopics.connector import Resource, Topic, EditorialType, StructuredDocument, Metadata

sub_topic = Topic.create(
content_id="child-topic-id",
title="Child topic title",
body="<p>Body of the <strong>child</strong> topic</p>"
)

topic_A = Topic.create(
content_id="topic-a-id",
title="Topic A title",
body="<p>Body of the topic <strong>A</strong></p><p><img src='my-resource'/></p>",
children=[sub_topic]
)

topic_B = Topic.create(
content_id="topic-b-id",
title="Topic B title",
body="<p>Body of the topic <strong>B</strong></p><p><a href='topic-a-id'>link to another topic in the <strong>same</strong> publication</a></p>",
children=[]
)

topic_C = Topic.create(
content_id="topic-c-id",
title="Topic C title",
body="<p>Body of the topic <strong>C</strong></p><p><a href='topic-a-id' data-ft-link-type='baseId'>link to another topic in <strong>another</strong> publication</a></p>",
children=[]
)

book_A = StructuredDocument.create(
document_id="my-structured-document-book-a",
title="My Structured Document - BookA",
locale="en-US",
pretty_url="my-pretty-structured-document-book-a",
toc=[topicA, topicB],
editorial_type=EditorialType.BOOK
)

book_B = StructuredDocument.create(
document_id="my-structured-document-book-b",
title="My Structured Document - BookB",
locale="en-US",
pretty_url="my-pretty-structured-document-book-b",
toc=[topic_C],
editorial_type=EditorialType.BOOK
)

The following screenshots illustrate how a cross-document link is displayed in the Reader page:

external_link

external_link_popup