IC SunsetThe developerWorks Connections Platform is now in read-only mode and content is only available for viewing. No new wiki pages, posts, or messages may be added. Please see our FAQ for more information. The developerWorks Connections platform will officially shut down on March 31, 2020 and content will no longer be available. More details available on our FAQ. (Read in Japanese.)
Topic
  • 2 replies
  • Latest Post - ‏2016-09-21T08:50:43Z by JGeens
JGeens
JGeens
7 Posts

Pinned topic Adding custom html code to the published pages

‏2016-07-28T13:33:14Z |

Hi, I would like to know if it is possible to add custom html between the <HEAD> tags and somewhere beween the <BODY> tags so that all published pages contain our own custom html by default.
I know you can add html - but that's for one page only. What I want is that I can do it somewhere at one place so that all pages have it by default.

Thanks a lot for any input!

Updated on 2016-07-29T07:56:58Z at 2016-07-29T07:56:58Z by JGeens
  • BruceJMacIsaac
    BruceJMacIsaac
    41 Posts

    Re: Adding custom html code to the published pages

    ‏2016-08-11T17:33:07Z  

    Hi,

    Yes, you can do this.

    What I recommend for this is to use the "skins" feature provided by RMC.

    You can read about this here:

    https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W6b0a089a62f3_4493_bcc1_ebe60a2ebb41/page/Customizing%20with%20Skins

    To do the kind of skin modifications you are talking about, I recommend the following.

    1. Create templates in common.xsl that generate the snippets of HTML that you want.

    2. Call these templates from the XSL file for each type of element.

     

    If you want to do something quick and dirty, you could:

    1. Modify one of the existing templates in common.xsl to do what you want.

    For example, I once modified the "copyright" template in common.xsl to insert some HTML at the bottom of every page (since I know that the copyright appears at the bottom of every page - that was an easy way to do it).

    2. Modify contentPage.js

    The javascript in this file creates the breadcrumbs that are displayed on every page.  When the breadcrumb HTML is generated, you could also generate other HTML elements.

    I hope this helps.


    Best wishes,

    Bruce MacIsaac

     

  • JGeens
    JGeens
    7 Posts

    Re: Adding custom html code to the published pages

    ‏2016-09-21T08:50:43Z  

    Hi,

    Yes, you can do this.

    What I recommend for this is to use the "skins" feature provided by RMC.

    You can read about this here:

    https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W6b0a089a62f3_4493_bcc1_ebe60a2ebb41/page/Customizing%20with%20Skins

    To do the kind of skin modifications you are talking about, I recommend the following.

    1. Create templates in common.xsl that generate the snippets of HTML that you want.

    2. Call these templates from the XSL file for each type of element.

     

    If you want to do something quick and dirty, you could:

    1. Modify one of the existing templates in common.xsl to do what you want.

    For example, I once modified the "copyright" template in common.xsl to insert some HTML at the bottom of every page (since I know that the copyright appears at the bottom of every page - that was an easy way to do it).

    2. Modify contentPage.js

    The javascript in this file creates the breadcrumbs that are displayed on every page.  When the breadcrumb HTML is generated, you could also generate other HTML elements.

    I hope this helps.


    Best wishes,

    Bruce MacIsaac

     

    Hi Bruce, sorry it took so long for me to reply. Other issues came along.
    Anyway, I tried the common.xsl trick and that worked out great!
    Thanks a lot!