Try our conversational search powered by Generative AI!

Move the viewstate code to the bottom of the page?



is there a standard snippetcode or fix to place the viewstate code to the bottom of the page and by that make it more Google Friendly?

(Google only indexes the first (n) bytes of the page)


best regards



Apr 24, 2008 14:17

Hi Jesper.

If you are running EPiServer CMS 5, you will find a class called ViewStateMover.cs shipped with the EPiServer templates. Just include the class in you project and enable the ViewStateMover in Web.Config (<add key="enableViewStateMover" value="true" /><add key="enableViewStateMoverWhitespaceRemoval" value="true" />), and you are good to go :)

I had some problem with the ViewStateMover when using XForms in edit mode(the following scripts were removed and newer added again: <script src="/Util/javascript/episerverscriptmanager.js" type="text/javascript"></script>
<script src="/SiteUI/javascript/system.js" type="text/javascript"></script>
<script src="/SiteUI/javascript/system.aspx" type="text/javascript"></script>
<script src="/Util/javascript/common.js" type="text/javascript"></script>), so I added a check so the ViewStateMover was excluded in edit and admin mode.



Apr 24, 2008 15:01

Yes I found that directly after I posted this one and will use it in my CMS 5 project but I was looking for a quickfix for a old CMS 4.5
But I will also test to set viewState=false on some pages




Apr 25, 2008 8:24

There was the old SEOViewState addon to EPiServer that automatically moved the large viewstate data to the end of the HTML page.

I've used it and it was really easy.  I think I got it from the EPiMore page. Have a look around.

Apr 29, 2008 5:34
* 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.