Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Editing <head> section




I was just wondering if there was any way of editing the <head> section with the standard development roll out? Or does this require development?



Jul 19, 2013 13:07

As far as I've seen for various sites <head> modifications are done by using some custom approaches - like providing some properties on page instance, that are taken into account while rendering layout / master page page. Anyway what is the problem you are looking for a solution?

Jul 20, 2013 20:36

Basically we want to be able to add tracking code/website testing code to different pages on the site when required. I'd rather do this without development time if possible. Do you think it would be a lot of work for a developer to add this functionality?



Jul 25, 2013 15:03

If you are using WebForms you can easily do it in Master page for instance:

Page.Header.Attributes.Add("test", "test");


If you are using MVC you can do it in Layout page for instance:

@model SomeGenericViewModelContaingHeadValue

<head attribute="@Model.Property">




Of course there should be somewhere a logic what exactly you are going to write to Head element :)

Jul 25, 2013 15:23

Ah great, thanks - so you mean i'd need to define what parameters would be allowed? I basically want to be able to add Google Content Experiments code, so it should have some consistent code - is that what you mean? 

Jul 25, 2013 15:42

I mean tha somewhere you have to have some sort of business logic that will decide what excatly is added t Html head element, either that's done in code, on fly or in cosmos :) Not really familiar with GCE but I suppose if something need to be added for page head element depending of what kind of page it is and should be editable by CMS editors - then most probably the easiest way would be to add property to base PageData and read and use that while rendering page.

Jul 25, 2013 15:48

Ah ok, that's really helpful. Thanks for your quick responses! I will chat to our developer, this could be really helpful!


Will keep you posted!

Jul 25, 2013 15:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.