Store Community Support Documentation

Hello,

I have a dumb newbie question. :) If I add a simple block on a page that just contains HTML and JS code, and it uses additional Javascript libraries, where would I put the libraries to make sure they're accessible from everywhere? I presume there's a way to get them to automatically load on each page, but I'm still very unfamiliar with the file and folder structure. There's no PHP or controller involved in this block - I just pasted the HTML into the block and it appears to load, but it can't find the JS files, and I presume I shouldn't link to them from the block either - I'd rather link from the main header.

Last update on April 28, 11:53 pm by Lee Flier.
Scheinwelt-Media
#1

you can add the libraries to the layout file of your theme. go to theme editor, edit your theme, open html tab...

#2

Thank you, yes, I considered that, but I was hoping there was a more universal place so that the JS libraries would still be available even if I change themes.

Last update on April 29, 3:38 pm by Lee Flier.
#3

And I was also wondering where to actually put the libraries. Just looking for recommended best practices here... I can hack things in but I'd rather do it the right way and it seems there's a way to add JS libraries and auto-load them, for any theme.

YouNetCo
#4

Dear Lee Flier,

I know another way to include JS libraries into all pages, it's you create a block with the "Site Wide" option and place JS into it.

They will be kept if switching other themes.

Kind Regards,

YouNetCo

#5

Ahh, very good! I’ll try that, thanks. 

Where would you put the JS libraries themselves?

YouNetCo
#6

Dear Lee Flier,

If you'd like to load on all pages, you can place at "Side Wide". Otherwise, you can place near your HTML codes

Kind Regards,

YouNetCo