Paligo HTML5 outputs use JavaScript (JS) to provide various features and you can also upload your own JavaScript. With JavaScript, you can add behavior to the webpage.
You can use JavaScript to change your HTML output after they have been published. For example, you can use JavaScript to change the icons that are shown for the categories on the help center portal page.
To add a custom JavaScript file to a layout:
-
Select the Layout tab in the top menu.
Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.
-
Select the layout to be updated or Create a Layout.
-
Select CSS, JS, logos and other assets in the sidebar.
-
Scroll down to the Custom Javascript section.
-
Select Upload and choose the custom JavaScript you want the layout to use.
-
Select Save.
When you use this layout to publish content, the JavaScript will be included in the output. When an end-user opens the help, their browser will run the JavaScript and apply the customizations.
The HTML5 help center has a "breadcrumb" at the top of the page that shows the path from the home page to the currently displayed topic. Each part of the breadcrumb is a clickable link to that topic.
By default, the home link is named the same as your publication. If you select it, the Publication Topic is shown. You can make it display a different page of your choice (for example to return to the start page).
To change the breadcrumb homepage link:
-
Use a third-party code or text editor to create or update a JavaScript (JS) file.
For example,
mycustomscript.js
. -
Add the following code to your JavaScript file:
$(document).ready(function () { $('.breadcrumb .breadcrumb-link:first-child a').attr('href', '/index.'); });
-
Change the 'index.html' part to an absolute URL for the page that you want the breadcrumb link to go to. The URL needs to define the route from the server to the index.html file. As an example, the Paligo help center has this:
$(document).ready(function () { $('.breadcrumb .breadcrumb-link:first-child a').attr('href', '/docs/index.html'); });
-
Save your JS file.
When you publish with this layout, the custom javascript is included. In the published output, it will tell the browser to display the page you included in the javascript when the breadcrumb homepage link is selected.
Paligo HTML5 outputs use JavaScript (JS) to provide various features and you can also upload your own JavaScript.
To use JavaScript, your HTML files have to reference them. Paligo applies the references automatically and by default they appear in the <head>
element of your HTML files. If you prefer, you can set Paligo to add the JavaScript references near the bottom, just before the closing </body>
element.
Recommended is to have JavaScript references at the end of your pages is better for SEO (Search Engine Optimization), as it means the pages will load quicker. But for some scripts, it may be a requirement to reference them in the <head>
element.
To control where Paligo inserts the JavaScript references:
-
Select the Layout tab in the top menu.
Paligo displays a list of Layouts. The list is empty if there are no custom Layouts in your Paligo instance.
-
Select the layout to be updated or Create a Layout.
-
Select CSS, JS, logos and other assets in the sidebar.
-
Set Place scripts at the end of the body tag to either:
-
Enable - To set Paligo to place JavaScript references near the end of the HTML in each page, before the closing
</body>
element. Recommended for SEO. -
Disable - To set Paligo to place JavaScript references near the top of the HTML in each page, in the
<head>
element. Default -
Default - To inherit the setting from the base layout. If the base layout is a "built-in" layout provided by Paligo, the inherited setting is Disable. If the base layout is a different layout, it could be Enable or Disable, depending on what is set in the other layout.
-
-
Select Save.
When you publish, Paligo will apply your choice to the output.
Comments
0 comments
Article is closed for comments.