Rules to Better Sitefinity

Hold on a second! How would you like to view this content?
Just the title! A brief blurb! Gimme everything!
SSW Rules to Better Sitefinity
  1. Do you know that caching is disabled when debug="true"

    ​​Sitefinity uses caching heavily so ensure debug="false" when deploying to non-development environments.

    When developing with Sitefinity in a local development environment, the compilation element in your web.config file will be set to false. While this is common practice when developing ASP.NET applications, Sitefinity disables caching in this scenario. This will make development slower (but easier as changes will be immediate) but will severly impact performance in test and production environments.

    4-07-2014-2-07-31-PM-compressor.png

    Figure: Default compilation settings in Sitefinity

  2. Do you know to use the Sitefinity Thunder Visual Studio extension?

    ​​​​If you are working with Sitefinity, then use Sitefin​ity Thunder.

    ​Sitefi​nity Thunder integrates with Visual Studio and provides rich functionality to develop and deploy custom Sitefinity changes.

    For example:

    • allows developers to automatically deploy custom code to multiple Sitefinity projects
    • accelerates custom development by connecting to Sitefinity instances inside Visual Studio. Once connected, Sitefinity Thunder supports a wide range of activities, including: modifying templates, deploying widgets, updating themes and much more
    • provides easy deployment to Azure through the Deploy to Azure wizard​

    4-07-2014-1-08-52-PM-compressor.png

    Figure:​ The Sitefinity Thunder dashboard

    You can find out more at http://www.sitefinity.com/resources/tools/sitefinity-thunder​.

    Installing Sitefinity Thunder​

    It can be installed from Visual Studio | Tools | Extensions and Updates...

    4-07-2014-12-35-25-PM-compressor.png

    Figure: Add an extension to Visual Studio


    4-07-2014-12-52-20-PM-compressor.png

    Figure: Search for 'Sitefinity Thunder' in Extensions and Updates | Online


    4-07-2014-12-58-32-PM-compressor.png

    Figure: Once installation is completed, you'll be prompted to restart Visual Studio to use Sitefinity​ Thunder

    Once Visual Studio is restarted, you'll be presented with the dashboard from top of this article.

  3. Do you tell your designers to only use classes?

    In Sitefinity you can alter the appearance and content areas on your webpage using "Layouts". These layouts are basically just Divs with sizes applied.

    Use classes only
    Figure: You have the ability to assign a Class to a Div only. No other customisations can be made

    Additionally, Sitefinity will hard code the widths of the layout and there is no way to stop it.
    The hack work around is to manually remove the widths via JQuery:

    $(".sf_colsOut").css("width", "");

  4. Do you get ready to wait?

    Initial Sitefinity load times are quite bad.
    On a live site you can do things like keeping the site warm though IIS however for developers this process takes quite a bit of time.

    Sitefinity caches everything, checks licenses, creates in memory pages from the content in the DB, etc.
    There will be a lot of small quick query's against the Sitefinity SQL database and it is important that these remain quick.

    1. Only compile when you are sure your code will work. It is also a good idea to complete 2 or 3 different things that you can test upon a rebuild to save time.
    2. Disable Sitefinity modules that you are not using or don't need.
      We recommend disabling all modules and only enabling items that you require.

      You can access the Module list via the Sitefinity backend.

      Figure: Administration -> System -> Modules
    3. Ensure that the Sitefinity database is indexed and the Statistics are updated.
      This will ensure that the Sitefinity query's remain quick: Sitefinity Database maintenance
    4. Use a reflection tool like DotTrace that can show you what is slow on application start time.
      Using this method we determined that Sitefinity was using reflection on assemblies to find any MVC widgets and add them into the Sitefinity widget list. This process took a few seconds and we removed tags to speed this up.​

    Telerik Suggestion: Have a best practise analyser wizard that is available in the backend which will look at the project and what is used and recommend settings that could be changed, modules that are not used, and any other improvements that can be applied.

    Read more about Do you get ready to wait?
  5. Do you know to create a Custom Library Provider?

    We have needed to create a custom CDN library provider.

    Sitefinity manages images, videos, and content on a file system which the website uses.
    For larger sites, CDN providers are used for all content that doesn’t need to be on the servers.

    Make a new class that inherits from Telerik.Sitefinity.Modules.Libraries.BlobStorage.CloudBlobStorageProvider and override all the methods.
    You want to save the items to a local path but show an external URL on the actual page.

    Once you have made your class then you need to register it in Sitefinity.
    Open the config file “App_Data\Sitefinity\Configuration\LibrariesConfig.config” in notepad and register your Class

        <?xml version="1.0" encoding="utf-8"?>
        <librariesConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="5.1.3270.0">
            <blobStorage defaultProvider="CDN">
         <providers>
      <remove name="FileSystem" />
      <add type="SSW.Sitefinity.Modules.Libraries.BlobStorage.CdnBlobStorageProvider" enabled="True" name="CDN" />
         </providers>
     </blobStorage>
        </librariesConfig>