Could it be that the path to script.js needs to be amended? If that file is in the root of your project and the topics are in folders, the relative path will be wrong so maybe RH is stripping it out because it cannot see that file. Also is it included in the baggage?
See www.grainge.org for RoboHelp and Authoring tips
Thanks for your reply. To answer your question, the scripts.js file is in the same directory as the topics, and I did add it as a baggage file.
I suspect that the location of the .js file is not the issue, though, because I also tried inserting the script in its entirety. In other words, instead of referencing a .js file with the src attribute, I placed the full script between <script> tags and inserted it between the <head> tags, like so:
[full text of script]
Unfortunately, the result was the same: In the rendered topic, the script is nowhere to be found.
This is going to somewhat depend on how you are using Master Pages. Keep in mind they may be used in two different ways.
Using them in way number one, you apply something such as a Header, Footer or Placeholder across existing topics.
Using them in way number two, you define the page as you want it to initially look. Perhaps a certain image inside a table and other basic things. Then you create totally new topics that use what you set up as a foundation.
If you attempted to insert the code in the Master Page *THEN* apply it to existing content, it's likely not going to work for you. But it may work for the second method I proposed.
Helpful and Handy Links
I think you nailed it. Thanks very much.
When I create new topics based on my master page, my custom script code is retained. If I try to apply the master page to existing topics, that's when the problems occur.
I had no idea there was a difference between using master pages to create new topics vs. applying master pages to existing topics, I'm not quite sure I understand why the behavior is different, but I can see that it is.
In any case, I'm left with a parting question:
If I want to my custom script to work with existing topics using the master page method, will I need to create new topics (based on my master page) and then copy/paste the body contents of the existing topics into those new topics? Or is there another, less painful method? :-)
You might try inserting the code in a Footer or a Header that is linked to a Master Page. If you have a Footer or Header linked to a Master Page you may apply the Master Page to all your topics and they will propagate accordingly. (And hopefully carry the script along)
This is because when the Master Page is applied to the Topics, the link isn't amended properly to include different folder levels.
Helpful and Handy Links