Topics Map > Documents Tab
Topics Map > Advanced HTML

KB User's Guide - Documents Tab - Where To Place <link> Tags

The TinyMCE editor does not allow <link> tags to be placed in the document body. You may find that tags you are attempting to add are not being saved, or you may see an alert warning that <link> tags previously stored in the doc body are being removed. This document provides guidance on how to update your document to appropriately include the linked content (usually a CSS file).

Choosing a Method

There are two ways to handle <link> tags that may have been previously stored in the doc body or otherwise need to be added—move them to a different field, or import the file(s).

Please note that the instructions below assume you received an alert about existing tags, however, the same approach can be used for CSS files that you are attempting to add.

Move Tag to JavaScript/CSS Field

This option is the most appropriate provided you do not need to include the doc (with its CSS) inside another doc or as a content module on your KB site's homepage. This is because it allows the page to load more efficiently.

  1. Copy the <link> tag(s) listed in the alert.

  2. Expand the Additional Fields section at the bottom of the document edit screen, then paste the copied tag(s) into the JavaScript/CSS field.

  3. Save or submit your document.

Create an @import Rule

If you are going to be embedding the document with linked styles into other KB docs or on your homepage, and you specifically need the CSS to be present when you are embedding it, then you can instead use an @import CSS rule to pull the CSS into the doc body.

  1. To do this, switch into the editor's Source mode view. This can be done by going to the View menu and selecting Souce code, or by clicking the Source code button in the toolbar.

  2. If your document does not already contain <style> tags in the body, add opening and closing tags, i.e., <style></style>

  3. Between the <style> tags, type @import url("filepath"), where "filepath" is the path to the CSS file that was listed in the alert. For example, if the tag in the alert was <link rel="stylesheet" href="/images/group41/114990/my-styles.css" type="text/css">, your new rule would be:

    <style>
    @import url("/images/group41/114990/my-styles.css");
    </style>
  4. Save or submit your document.



Keywords:
links css external stylesheets moving copying body fields javascript/css import rule @import
Doc ID:
114990
Owned by:
Leah S. in KB User's Guide
Created:
2021-11-24
Updated:
2021-11-29
Sites:
KB User's Guide