Page 1 of 1

add custom js in search pages

Posted: Tue Apr 21, 2020 10:48 am
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

Re: add custom js in search pages

Posted: Wed Apr 22, 2020 8:23 am
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

Re: add custom js in search pages

Posted: Fri Apr 24, 2020 10:08 am
by catherine
Thanks for your help! :)
The custom js files are working now.