The dynamic content library item provides a way to produce HTML content using HelpNDoc's built-in scripting methods and API. Dynamic content placed within topics are interpreted at generation time to produce content which is then integrated in the final documentation file. It can be useful in multiple situations:

  • Produce personalized documentation based on some conditions, such as topic properties, build settings...
  • Topic-specific content display, such as listing children topics, or associated keywords
  • Time-sensitive updates, which are only displayed based on the current generation date and time
  • Content formatting, such as converting external JSON or XML files to human-readable tables
  • And more...

Note: Even though they are based on HTML and scripts, dynamic content are compatible with every documentation formats supported by HelpNDoc, including Word and PDF formats.

Overview of the user interface

1. Library item name

Choose a unique name for that library item.

2. Source

Choose if the content is stored within the project or loaded from an external file at generation time

3. Dynamic content editor

Specify the dynamic content's HTML-based script using the built-in editor. Use the "Build" button to check that the syntax is valid.

4. Build output

Once built, any information, warning or error messages produced during the build process are displayed in the build output log.

Sample dynamic content scripts

List of children topics

When placed within a topic, the following script produces a lists of links to access all its generated direct children topics:

  var aChildrenTopicList := HndTopicsEx.GetTopicDirectChildrenListGenerated(HndTopics.GetCurrentTopic());
  if (aChildrenTopicList.Length > 0) then
  <% for var nTopic := 0 to aChildrenTopicList.Length - 1 do begin %>
    <li><a href="hnd-topic://<%= aChildrenTopicList[nTopic].id %>"><%= aChildrenTopicList[nTopic].Caption %></a></li>
  <% end; %>
<% end; %>

List of associated keywords

Place this dynamic content in a topic to produce a list of all keywords attached with this topic:

  var aKeywordsList := HndTopicsKeywords.GetKeywordsAssociatedWithTopic(HndTopics.GetCurrentTopic());
  for var nKeyword := 0 to aKeywordsList.Length - 1 do
  <span style="background-color: #eee"><%= HndKeywords.GetKeywordCaption(aKeywordsList[nKeyword]) %></span>