It's all about the answers!

Ask a question

Call to external libraries within Publishing

Alioune COULIBALY (1) | asked Mar 14, 9:08 a.m.

Hello there,

I am desperatly trying to use javascript external (i.e. not functions in a javascript code palette element) libraries (for instance jquery.js or underscore.js) in a Publishing template.
But I can't manage to get through!

My wish is to be able:
1°) Ideally to put a reference(same principle as in html pages, e.g. <script src="jquery-3.6.3.js"></script>) somewhere in Publishing document studio.
2°) if reference are not possible, what code structure to use for copying and pasting ? I tried to paste the code of the jquery-3.6.3.js file and it yielded errors.

Thanks in advance for your help.

Fariz Saracevic commented Mar 15, 7:48 a.m.

Hi Alioune,

As far as I know, you would not be able to add javascript external call directly from a template. You would need to use PUB javascripting capability to extent it but I am not sure if this is possible. Searching, I see quite a bit of responses where using external libraries with javascript. Also, PUB javascripting is valuable for PUB customers but it is provided as-is, so this community is good place to seek answer. Thanks for raising this question.

It would help if you could provide your details of your use case as there might be other ways to solve your problem.

Alioune COULIBALY commented Mar 16, 4:46 a.m. | edited Mar 16, 4:49 a.m.
Hi there Fariz,
Thanks for this clear answer.
FYI I have no particular use case to supply you with. This was a general question asked by several customers and I wanted to have a clear status on the topic.
As for me, using code from libraries via javascript code import in a javascript code element of a PUB template is fine enough.
Kind regards

Be the first one to answer this question!

Register or to post your answer.