Add External Links Icons
THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO
In this tutorial, you will learn how to add small link icons to all links in your collection that target an external http server. You need the Professional version of Tópico to complete this tutorial.
Adding a little icon like this one to each and every link that targets an external http server might prove to be a very tedious task if you manage a lot of individual HTML files. Doing it with Tópico will only take a few minutes.
Create the generated content snippet
While you needed only to know enough about HTML to come up with some generated content in this intermediate tutorial, a little knowledge about XPath will get you much further. This is the generated content type you'll use to get at all those external links.
- Select the Publishing tab;
- In the Generated content grid, add the following entry.
Type | Position | Text | Content |
---|---|---|---|
XPath | After | //xhtml:a[contains(@href,'http')] | <img class="external_link" src="images/external_link.jpg"/> |
The XPath expression selects all anchors elements (<a>) that have a href attribute that contains "http". The Content is then added After the selected node.
If your generated content snippet is of the XPath type, then the Text shall be a valid XPath expression and the Content shall be a well formed and complete element. A complete well formed element has a begining and an end tag.
Create the stylesheet selector
If you publish your collection now, the image will be misaligned with the surrounding text, whcich does not look good. To adjust how the image is aligned with the text, you must add the appropriate selector to your stylesheet.
- Select the Content or Topic tab;
- Click on the small button beside the Stylesheet drop down list;
- Open the publication stylesheet;
- Add the following selector;
- Save the stylesheet;
img.external_link {position:relative; margin:0px; margin-left:1px; padding:0px;}
The image now aligns nicely with the surronding text.
THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO