Linking to Other Topics Edit on GitHub


Storyteller has a custom syntax to link to other topics in a topic file just to handle the various url modes in previewing and publishing.

In all the use cases shown below, you can find samples in Storyteller's own layout.htm file that specifies the layout of this website.

In its simplest form, you will use a syntax like:

<[linkto:documentation/docs/authoring]>

Which will render this: Authoring Topics. The default output will be a link to that topic with the proper Url and using that topic's title as the link text.

The path after the colon is effectively the relative path from the documentation root to the topic file, minus the .md extension. index.md files are referenced by just its parent directory.

You can also relative links in the <p class="bg-warning" style="padding:5px"><b>Unknown topic key &#x27;path&#x27;</b><small> -- CTRL&#x2B;SHIFT&#x2B;R to force refresh the topic tree</small></p> structure. If the path starts with a forward slash like this:

<[linkto:/authoring]>.

Assuming that there is another topic with the file name authoring.md in the same directory as the current topic file, you'll get the same link. StorytellerDocGen can respond to paths like /../other as well.

To override the link text, use a format like this:

<[linkto:documentation/docs/authoring;title=A different link description]>, which renders: A different link description.

You can override the construction of the link html by explicitly defining the html template in the directive usage like this one sample that is taken from Storyteller's own documentation layout.htm.

<[linkto:;<li><a href="" title="">Previous</a></li>]>

The substitutions are just common handlebars kind of templating for the line () and the title ().

As part of your layout.htm file, you may want to have a link to the next topic if one exists. If you are on the very last topic in the structure, you don't want that topic to render at all. In that case, use the text {next} as the topic key.

Likewise, you can create a link to the previous topic by using {previous} as the topic identifier.