add custom js in search pages

Post here questions and problems related to editing and publishing DITA content.
catherine
Posts: 158
Joined: Fri Nov 10, 2017 8:16 am

add custom js in search pages

Post by catherine »

Hi,
I added my customized js files in the .opt files, these js files are not applied to the searching result pages?
How to add custom js in the searching result pages?

Regards,
Catherine
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: add custom js in search pages

Post by alin »

Hello,

The recommended procedure for inserting additional content in your output files is via HTML fragment files and it is described here: https://www.oxygenxml.com/doc/versions/ ... -html.html
There are no specific placeholders for the Search Page. However, there are some general placeholders available for all pages, including the Search Page:
- webhelp.fragment.head - your content will be included in the <head> element of the output page
- webhelp.fragment.before.body - your content will be included after that start tag of the <body> element
- webhelp.fragment.after.body - your content will be included at the end of the <body> element, just before the </body> end tag

If your HTML fragment files reference other resources (like JS in your case) you should make sure that those files are also copied in the output. Here is how: https://www.oxygenxml.com/doc/versions/ ... urces.html
Please note that the path references to the resources mentioned above should be expressed relatively to the Publishing Template's root directory using the ${oxygen-webhelp-template-dir} macro. For example:

Code: Select all

<html>
  <script type="text/javascript" src="${oxygen-webhelp-template-dir}/js/test.js"/>
  <link rel="stylesheet" type="text/css" href="${oxygen-webhelp-template-dir}/css/test.css"/>
</html>
Please let me know if you have further questions.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
catherine
Posts: 158
Joined: Fri Nov 10, 2017 8:16 am

Re: add custom js in search pages

Post by catherine »

Thanks for your help! :)
The custom js files are working now.
Post Reply