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

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

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
Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the community!

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Users online (1,568)