Edit PortalTemplate.aspx page in Kentico 12

ruchika sharma asked on April 21, 2021 14:49

hi

Please help how can we add or remove our custom java scripts references from portaltemplate.aspx page under CMSPages.

Thank you ruchika

Recent Answers


David te Kloese answered on April 22, 2021 09:50

There are a quite a few locations you could add custom scripts. Why do you specifically mention portaltemplate.aspx?

Most common are

  • the Masterpage (in Pages application)
  • in a specific Template on the Head section (Page Templates application)

Less common are

  • using the WebPart 'Head HTML Code' - can be on any template
  • in custom code: look for Page.Header.Controls.Add(...
  • directly in the PortalTemplate file ~/CMSPages/PortalTemplate.aspx

I wrote a blog about it about 5 years ago if you want to see some info or details on it:

https://devdavid.nl/dtk/february-2016/conquer-the-five-heads-of-kentico

0 votesVote for this answer Mark as a Correct answer

ruchika sharma answered on April 22, 2021 10:01

Thanks David. I understood the concept and now I want to change the structure of my application and want to undo the custom javascripts references from portaltemplate.aspx. But on server, any changes to portaltemplate.aspx is not reflecting and I am not able to remove those unnecessary javascripts references from portaltemplate.aspx.

Can you please suggest me how to clean up my portaltemplate.aspx file on server once.

thank you Ruchika

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on April 22, 2021 10:06

So there where custom references directly in the portaltemplate.aspx which you now have removed?

Probably they where added in another location too. Have you checked the masterpage(s) and templates?

0 votesVote for this answer Mark as a Correct answer

ruchika sharma answered on April 22, 2021 10:44

yes custom references to javascripts are on portaltemplate.aspx BUT not able to remove it. so im stuck there as any changes to portaltemplate.aspx on server , does not relfect

Is there any way I can remove those references from portaltemplate.aspx? Thank you Ruchika

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on April 23, 2021 09:56

You say doesn't work on the server, does it work locally?

Most important is to make sure it's cache or that it originates from a different location. Is just this specific removal not working or no change at all? As in try adding or even clearing the whole file... if that also has no visual effect you might be looking at the wrong thing.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 29, 2021 06:30

Some of those custom references cannot be removed as they are baked into the CMS. Maybe share which ones you're seeing and why you want to remove them. Also make sure you're validating your page requests in a private window not logged into Kentico.

0 votesVote for this answer Mark as a Correct answer

ruchika sharma answered on May 13, 2021 15:30

hi basis the solution provided, we made changes to portaltemplate file on our local and redeployed the solution on new path on server. And all changes were relfected.

thank you Ruchika

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.