cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JustineS
Regular Visitor

Web File vs Web Template

Hello community,

 

I'm setting up a portal from scratch and I was wondering what's best practice, using Web files or Web Templates?

 

I've read that before you can use web files you have to delete the '.js' extension from your blocked file extensions.  Does this have disadvantages? Everyone can therefore start uploading JavaScript files, this does not feel secure.

But on the other hand, separate files seem more convenient.

BlockedExtensions.png

I'm planning on making a JavaScript bundle by using Typescript. If I would use Web Templates should I create 1 template file for the whole bundle?

 

It would be interesting to know the advantages and disadvantages of both.

 

Thanks in advance !

 

Regards,

Justine

1 ACCEPTED SOLUTION

Accepted Solutions
OOlashyn
MVP

Hi @JustineS ,

 

Web Templates and Web Files have a completely different purpose. Web Files are using to store your portal assets (css, js, images). And Web Templates provide you with actual HTML code for your pages. You, of course, can write a js code as a part of your Web Template (and you often will) but is not a most reusable scenario if you want to use that code in multiple places. 

Regarding js extension - yes by default you cannot use js files as attachments and you will need to remove it from System Settings. However, it is just one of the approaches. Another commonly used approach is to switch extension of your js files to something like .es or .myjs (or literally anything else) and upload it that way to the system. 

Regarding best practices, I would advise checking this blog post from Arpit Shrivastava.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

View solution in original post

1 REPLY 1
OOlashyn
MVP

Hi @JustineS ,

 

Web Templates and Web Files have a completely different purpose. Web Files are using to store your portal assets (css, js, images). And Web Templates provide you with actual HTML code for your pages. You, of course, can write a js code as a part of your Web Template (and you often will) but is not a most reusable scenario if you want to use that code in multiple places. 

Regarding js extension - yes by default you cannot use js files as attachments and you will need to remove it from System Settings. However, it is just one of the approaches. Another commonly used approach is to switch extension of your js files to something like .es or .myjs (or literally anything else) and upload it that way to the system. 

Regarding best practices, I would advise checking this blog post from Arpit Shrivastava.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

Helpful resources

Announcements
Welcome Super Users.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,394)