Referencing an external CSS

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Referencing an external CSS

Post by mdslup »

Referencing an external CSS

I am using Oxygen 20.0, Webhelp Classic.

Imagine this scenario:

Our company makes a product and provides an online manual. The product is then sold by 3 separate companies, who want a "customized" version of the manual with their own branding.

To handle this, I set up a server with 3 different directories. Each directory represents a different company. Each directory contains 3 files: CompanyLogo.png, CompanyCSS.css, and CompanyFavicon.png. So here is the structure of the server:

/
-->Company1
---->CompanyLogo.png
---->CompanyCSS.css
---->CompanyFavicon.png
-->Company2
---->CompanyLogo.png
---->CompanyCSS.css
---->CompanyFavicon.png
-->Company3
---->CompanyLogo.png
---->CompanyCSS.css
---->CompanyFavicon.png

I want to generate the manual ONCE, then upload the output files to each directory and have the logo, css, and favicon take effect.

==Logo==

I can set the webhelp.logo.image parameter to "CompanyLogo.png"; I have tested and verified this works.

==CSS==

What transformation parameter should I use to specify the relative path to the CSS on the server? Because each CompanyCSS.css file is different, I do not want to associate a particular CSS to my transformation scenario; I only want to point to where it will be. I tried both args.css and args.csspath, but neither worked.

==Favicon==

Similar to the CSS above, I do not want to associate a favicon with a transformation scenario, I only want to reference where it will be.


Thanks.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Re: Referencing an external CSS

Post by mdslup »

Does the problem make sense how I have described it?
bogdan_cercelaru
Posts: 222
Joined: Tue Jul 01, 2014 11:48 am

Re: Referencing an external CSS

Post by bogdan_cercelaru »

Hello,

You could achieve this using the webhelp.head.script parameter that points to an XML file like the one below:

Code: Select all

<head>
<link rel="stylesheet" type="text/css" href="${oxygen-webhelp-output-dir}/CompanyCSS.css" />
<link rel="icon" href="${oxygen-webhelp-output-dir}/CompanyFavicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="${oxygen-webhelp-output-dir}/CompanyFavicon.png" type="image/x-icon" />
</head>
In this case, the ${oxygen-webhelp-output-dir} macro will be expanded to a path relative to the output directory so that it will point to the

Code: Select all

CompanyCSS.css
file located where the generated output will be copied.

Regards,
Bogdan
Bogdan Cercelaru
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Re: Referencing an external CSS

Post by mdslup »

I should have thought of that!

OK, so I note that this puts a custom head into the HTML pages of topic files. Is there a way to put custom code in the HEAD of the *main* page?
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Referencing an external CSS

Post by ionela »

Hi,

Unfortunately, it is not possible to put the custom code in the HEAD section of the main page.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
Post Reply