Applicability panels are sections that appear in a topic, usually at the top of your HTML5 output. The categories show whether the content in the topic applies to those categories.
For example, in the Paligo help, we have applicability panels in some topics to show that the information only applies to certain plans. To help you understand what a complete, working applicability panel JS file and CSS look like, see Example Applicability Panel JS and CSS.
However, you can use applicability panels for many different purposes, such as showing that a topic applies to a particular audience or particular models of a product.
To create applicability panels for topics, there are four stages:
-
Activate Output Taxonomies as Classes to be able to use Applicability Panels.
-
Create Applicability Panel Categories to be applied to your topics.
-
Add Applicability Panel to JS file to add a category list.
-
Style Applicability Panel in CSS to style the category list.
Paligo can output taxonomies as classes in the HTML that is generated for your HTML5 outputs. These classes are needed for various taxonomy-related features, including applicability panels and taxonomy filters.
To set Paligo to output taxonomies as classes for HTML5:
-
Select Layout in the top menu.
-
Select the Layout you want to update or Create a Layout.
Tip
You can copy the URL of the Layout Editor and paste it into a new tab in your browser. This can be useful if you frequently switch between your Paligo content and the Layout settings.
-
Select Classes and attributes in the sidebar.
-
Set Output Taxonomies to Enable.
This tells Paligo to include the taxonomy labels as class names in the HTML output.
-
Select Save.
To display the Applicability Panel for Paligo topics, you apply taxonomy tags created for this purpose.
These need to be organized into a hierarchy, where there is a "parent" tag (name of the applicability panel) and "child" tags for each category to appear in your applicability panel (Professional, Business and Enterprise).
In some Paligo help topics, you can see an applicability panel called Plan availability. For this we have a taxonomy hierarchy where:
-
Plan is the parent taxonomy tag in Paligo.
-
Business, Enterprise and Professional are the child tags (categories) that have been applied to the help topics.
Tip
You can check if a taxonomy tag has been applied to a topic in the Resource View, Taxonomies View, Content Manager and in the Metadata Panel in the Editor.
However, you can only create new taxonomies and organize the taxonomy tags in the Taxonomy Manager or Taxonomy Floating Content Panel.
To create an applicability panel taxonomy and apply the child tags to your content:
-
In the Content Manager, expand the Taxonomy Manager section.
-
Select the options menu ( ... ) for the top-level Taxonomies tag.
-
Select Create taxonomy tag and then enter a name for the applicability panel (parent tag).
-
Select the dotted menu ( ... ) for the parent tag, and then select Create taxonomy tag.
-
Enter a name for the first category ("child" tag).
-
Repeat step 4 and 5 to add all categories for your applicability panel.
-
Select the options menu ( ... ) for the top-level Taxonomies tag.
-
Select the Floating Content Panel option to display the Taxonomy Floating Content Panel.
-
Drag and drop the "child" tags from the Taxonomy Floating Content Panel onto the relevant topics in the Content Manager , see Apply Taxonomy Tags to Topics.
Note
When you have added the taxonomy tags, the content is ready. The next step is to Add Applicability Panel to JS file.
To make the applicability panel work in your HTML5 output, you will need to add some custom JavaScript to your HTML5 layout.
The script will tell the browser to wait until the page has loaded, then run a function that adds a list of categories to the page. The categories have to match the names of the applicability panel taxonomy tags in Paligo.
Note
The JavaScript only adds a list with your categories. You will style it at a later stage, using CSS, see Style Applicability Panel in CSS.
To get an idea of what a working, customized script looks like, see Example Applicability Panel JS and CSS.
Important
If the HTML5 layout already uses a customized JavaScript file, you should add your changes to that file instead of creating a new one.
If you upload a new JavaScript file, the existing one will be replaced and you will lose the functionality in the old JavaScript file.
To create your JavaScript:
-
Use a text editor or code editor for creating the JavaScript file.
-
Use the following script as a starting point:
$(document).ready(function () { addFunctionName(); $(document).ajaxComplete(function () { addFunctionName(); }); }); function addFunctionName () { if (! $("ul.listname").length) { var varforlist = '<ul class="listname">' + '<li class="parenttaxonomytag">Name of the applicability panel: </li>' + '<li class="childtaxonomytag1">Name of category 1</li>' + '<li class="childtaxonomytag2">Name of category 2</li>' + '<li class="childtaxonomytag3">Name of category 3</li>' + '<li class="childtaxonomytag4">Name of category 4</li>' + '</ul>'; $(varforlist).insertAfter('#topic-content > .section > .titlepage'); } }
-
Change
addFunctionName
to a name that describes what your script is going to add (for exampleaddAudienceList
).You will need to change the
addFunctionName
in all three places where it occurs, and it must use the same name in each place.Example 9. Change it to addAudienceName
If you change it to
addAudienceName
, you will have addAudienceName (); as line 2 and line 4, and functionaddAudienceName
at the start of the function definition (second section of script).
-
Change
"ul.listname"
andul class="listname"
to names that are more descriptive of your applicability panel list (for example,"ul.audiencelist"
andul class="audiencelist"
). The names need to match. -
Change
"varforlist"
to a variable name that is more suited to your script (for example,"audiencetypelist"
).The name has to be the same in both places, so if you change
varforlist
where it is declared, you also need to change it in the reference in$(varforlist).insertAfter
later in the script. -
Replace
li class="parenttaxonomytag"
with the name of your parent taxonomy tag in Paligo, see Create Applicability Panel Categories. This has to be an exact match. -
Replace
Name of the applicability panel:
with the title shown before the categories in HTML5, for example:'<li class="audience">Audience: </li>' +
-
Replace
"childtaxonomytag1"
with the name of the first child taxonomy tag in Paligo, see Create Applicability Panel Categories. This has to be an exact match. -
Enter the category name (as it will appear in the applicability panel) between
<li>
and</li>
, for example:'<li class="Novice">Novice</li>' +
-
Repeat step 8 and 9 for each of the list items, matching the applicability panel categories in Paligo.
-
Save your JavaScript file making sure it has a
.js
filename extension.
Note
The next step is to customize your CSS for the applicability panel, see Style Applicability Panel in CSS.
As well as custom JavaScript, the applicability panel needs some custom CSS. The CSS styles are used to:
-
Apply the checkmark when the content in a topic applies to one or more of the applicability panel categories
-
Apply different styles when the content in a topic does not apply to the panel categories
-
Hide the applicability panel by default, so that it is only shown when topics have at least one of the applicability panel taxonomy tags.
Below, we have included the styling used for a gray applicability panel. You can change the styles to meet your own needs.
Important
If the HTML5 layout already uses a customized JavaScript file, you should add your changes to that file instead of creating a new one.
If you upload a new CSS file, the existing one will be replaced and you will lose the styling in the old CSS file.
Tip
If you prefer the white Paligo applicability panel, see Example Applicability Panel JS and CSS.
To create the custom CSS for an applicability panel:
-
Use a text editor or code editor to create a custom CSS file.
-
Define the selector and styling for the overall list.
ul.listname
has to match the ul class and listname that was used in your JavaScript, see Add Applicability Panel to JS file.ul.listname { display: none; list-style-type: none; margin: 0; padding: 0; overflow: hidden; /*background-color: #333333;*/ margin-bottom: 1em; }
-
Define the styles for when the applicability panel should be shown.
You need to have selectors for each taxonomy tag (category). These use the syntax
.taxonomy-parent taxonomy tag-child taxonomy tag ul.listname,
:-
.taxonomy
is always included -
parent taxonomy tag
is the name of the applicability panel, see Create Applicability Panel Categories. -
child taxonomy tag
are the names of the categories, see Create Applicability Panel Categories. -
ul.listname
has to match theul.listname
used in your JavaScript (same as in step 2).
You need a separate selector for each taxonomy tag (category).
After the selectors, include
display: inline-block;
to tell the browser to show the applicability panel. Here, we have includedborder-radius
to set rounded corners on the panel too..taxonomy-parenttaxonomytag-childtaxonomytag1 ul.listname, .taxonomy-parenttaxonomytag-childtaxonomytag2 ul.listname, .taxonomy-parenttaxonomytag-childtaxonomytag3 ul.listname { display: inline-block; border-radius: 8px; }
-
-
Define the styles for the list items.
For the selector, replace
ul.listname
to match the ul class and listname that was used in your JavaScript (same as in step 2). Keepli
after it.Below, we have included styles for the positioning, color, and alignment. You can change these styles to suit your requirements.
ul.listname li { float: left; display: inline-block; color: #bbb; text-align: center; padding: 20px; background-color: #eee; }
-
Define the styles for the label list item on the applicability panel.
-
For the selector, replace
ul.listname
to match the ul class and listname that was used in your JavaScript (same as in step 2). -
Replace
parenttaxonomytag
with the name of your applicability panel used in your JavaScript.
Below, we have given the label a
color
andfont-weight
, but you can add other styles too.ul.listname li.parenttaxonomytag { color: #444; font-weight: bold; }
-
-
Define the styles for when the content does not apply to the categories.
You need to consider the different possible combinations of tags and include selectors for each combination.
For example, below we have styles for the possible combinations of three child taxonomy tags.
.taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag1, .taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag2, .taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag3, .taxonomy-parenttaxonomytag-childtaxonomytag2 .childtaxonomytag2, .taxonomy-parenttaxonomytag-childtaxonomytag2 .childtaxonomytag3, .taxonomy-parenttaxonomytag-childtaxonomytag3 .childtaxonomytag3, { color: #444; }
-
We have only set a color for the category text, but you could apply other styles too if needed.
Remember that these are the styles used when the content does not apply to these categories.
-
We have included selectors for three child taxonomy tags and their possible combinations.
If you have more tags, you will need to add more lines for each tag and its combinations.
-
-
Define the styles for when the content does apply to the categories.
These styles work in the same way as in the previous step, where there is a selector for each possible combination of classes.
But these selectors include
:before
, which adds styling before the category text. In this case, we have used CSS and a reference to FontAwesome to add a checkmark.You can apply different styling if you prefer. But you have to use the taxonomy-parent-child syntax, use selectors that match the names in your JavaScript, and include
:before
..taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag1:before, .taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag2:before, .taxonomy-parenttaxonomytag-childtaxonomytag1 .childtaxonomytag3:before, .taxonomy-parenttaxonomytag-childtaxonomytag2 .childtaxonomytag2:before, .taxonomy-parenttaxonomytag-childtaxonomytag2 .childtaxonomytag3:before, .taxonomy-parenttaxonomytag-childtaxonomytag3 .childtaxonomytag3:before,{ content: '\f00c'; font-family: FontAwesome; margin-right: 0.5em; color: #1976d2; }
-
Save your CSS with a
.css
file extension and Upload Customized CSS to your HTML5 layout.
To show you what the JS and CSS look like for a working applicability panel, we have included the script and CSS that we use in the Paligo help. We use these to produce the price plan applicability panel that is shown on certain pages.
The pricing plan (called Plan) used in the Paligo Documentation have the following applicability panel categories:
-
Professional
-
Business
-
Enterprise
The JavaScript we use for the applicability panel is:
function addPricePlan() { if (!$("ul.priceplan").length) { var priceplanlist = '<ul class="priceplan">' + '<li class="planlabel">Plan availability: </li>' + '<li class="professional">Professional</li>' + '<li class="business">Business</li>' + '<li class="enterprise">Enterprise</li>' + '</ul>'; $(priceplanlist).insertAfter('#topic-content > .section > .titlepage'); } }
Note
Note that where the function name is changed, it is changed everywhere in the script. The same applies for the variable name and list name too.
This CSS is slightly modified to work outside Paligo:
ul.priceplan{ /* Add your values here */ --padding:8px; --border-radius:8px; --box-shadow:2px 2px 2px 2px black; --clr-accent:blue; --clr-text:black; --clr-border:grey; display:none; list-style-type:none; margin:0; padding:0; overflow:hidden; margin-bottom:1em; box-shadow: var(--box-shadow); width:100% } ul.priceplan li{ color:var(--clr-text); text-align:left; padding:var(--padding); border-bottom:1px solid var(--clr-border); display:block } .taxonomy-plan-small-team ul.priceplan, .taxonomy-plan-professional ul.priceplan, .taxonomy-plan-business ul.priceplan, .taxonomy-plan-enterprise ul.priceplan{ display:inline-block; border-radius:var(--border-radius) } @media(min-width:768px){ ul.priceplan{ width:unset } ul.priceplan li{ border-bottom:none; display:inline-block } ul.priceplan li:not(:first-of-type){ border-left:1px solid var(--clr-border) } } ul.priceplan li.planlabel{ color:var(--clr-text); font-weight:700 } .taxonomy-plan-small-team .smallteam, .taxonomy-plan-small-team .professional, .taxonomy-plan-small-team .business, .taxonomy-plan-small-team .enterprise, .taxonomy-plan-professional .professional, .taxonomy-plan-professional .business, .taxonomy-plan-professional .enterprise, .taxonomy-plan-business .business, .taxonomy-plan-business .enterprise, .taxonomy-plan-enterprise .enterprise{ color:var(--clr-text); } .taxonomy-plan-small-team .smallteam:before, .taxonomy-plan-small-team .professional:before, .taxonomy-plan-small-team .business:before, .taxonomy-plan-small-team .enterprise:before, .taxonomy-plan-professional .professional:before, .taxonomy-plan-professional .business:before, .taxonomy-plan-professional .enterprise:before, .taxonomy-plan-business .business:before, .taxonomy-plan-business .enterprise:before, .taxonomy-plan-enterprise .enterprise:before{ content:"\f00c"; font-family:FontAwesome; margin-right:.5em; color:var(--clr-accent); }
Comments
0 comments
Article is closed for comments.