Views: 1992
Number of votes: 6
Average rating:

Best practises cheat sheet for your EPi site

  • Prefer Controllerless blocks
  • Don't Create Content Areas in Blocks, No nesting blocks.
  • Minimize database calls. Instead, use Episerver’s caching layer where ever possible.
  • Personalization might have an impact on performance, therefore make sure you implement personalization in a way that has the least possible impact.
  • Avoid frequent querying of the Dynamic Data Store.
  • Try to keep your content tree well balanced.
  • Prefer Lists over ContentArea where possible to avoid big content structures for complex pages.
  • Avoid dynamic properties.
  • Register UIDescriptor, where you disable on page edit and preview views
  • For settings kind of pages, ensure that it will not have a template
  • Use Episerver’s Object Cache instead of .NET’s built-in cache
  • Create all Content Types (Page Types, Block Types, Media Types) in code
  • For property (field) names in code, use standard .NET PascalCase. Make sure to set a friendly Display Name and Description
  • Plan a data hierarchy for Content Types, and use class inheritance
  • Organize groups of properties (fields) into tabs
  • Provide an order of properties, with frequently used properties at the top of each tab, Consider Editors
  • Set default values for Content Types’ Properties (if known)
  • For media properties, use the ContentReference type and the appropriate UIHint
  • Use the PropertyFor method to render properties (fields) in Content Type views
  • Make sure to always create the appropriate Media Types for assets in the project
  • Use Container Pages for folder nodes, without presentation (if required) use IContainerPage.
  • Plan carefully the content structure hierarchy, and avoid overloading a single level with too many pages
  • Make sure to load-test external systems integrations
  • Avoid resolving URLs repeatedly, think about cache.
  • Avoid creating blocks to use for image refernces and pages only along with some text as Alt

Disclaimer: Points have been learned from many different sources and experience, have been adding in my best practices document.

Jun 19, 2019

Praful Jangid
( By Praful Jangid, 6/20/2019 8:05:38 AM)

Thanks for listing out the checklist for the best practice. I have some questions like

  1. Why you want to avoid creating ContentArea on blocks?
  2. When you are saying personalization may have performance imapact. Are you just talking in reference of chaching or something else?

Thanks, and regards

Praful

K Khan
( By K Khan, 6/20/2019 9:17:44 AM)

1- Having Content areas in blocks open a wormhole for nested blocks, I will prefer to avoid by default, will prefer to discuss with the team if it really requires and see if this can be avoided. 

2- e.g. Custom Visitor Group Criteria depending on 3rd party services, can secretly effect performance, It will be hard to investigate, should be taken care in advance.

/K

Daniel Ovaska
( By Daniel Ovaska, 6/20/2019 12:28:51 PM)

1. I agree. Content Area in blocks might seem like a flexible solution yes. It can however get very difficult for editors and does also have some performance drawbacks. If possible, avoid nesting blocks in blocks except in rare cases. It's like most things. Blocks are great...in moderation. 

KennyG
( By KennyG, 6/20/2019 3:09:08 PM)

What do you suggest instead of nested blocks? PropertyList?

Praful Jangid
( By Praful Jangid, 6/20/2019 6:35:03 PM)

Thanks K Khan,

I see now, that using Block may create issue if not used properly. And for personalization, I never know that there are critetia's that may be using a third party service.

K Khan
( By K Khan, 6/20/2019 8:53:54 PM)

KennyG,

https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/generic-propertylist/

I will just echo Daniel. He explained it well 

/K

Stefan Holm Olsen
( By Stefan Holm Olsen, 6/21/2019 7:52:03 AM)

OMG, we must be twins, Khurram! 😉

Joke aside. I see that some of the key points regarding performance optimizations looks very much like points I very recently wrote on my personal blog (on June 2).

Maybe it is a coincidence, maybe it is copy/paste. But can we please refer or provide links, if we publicly use or refer to the written work of someone else?

K Khan
( By K Khan, 6/21/2019 8:13:22 AM)

You are right, I have added a disclaimer at the end of the blog (as it might cause offence, but I am afraid don't have references for those), This was the collection that I have been collecting from many different resources and was adding in my best practises cheat sheet from many years.

For me above link isn't working, we might be replicating here as generally, we all practise those. Glad you are also sharing your experience and learning.

This site can’t provide a secure connection

stefanolsen.com sent an invalid response.

ERR_SSL_PROTOCOL_ERROR

K Khan
( By K Khan, 6/21/2019 8:35:17 AM)

@Stefan, Looks like your site needs some attention and isn't available to a big audience.

http://stefanolsen.com (Look out! Your Virgin Media Child Safe settings have blocked this site)
https://stefanolsen.com/ (This site can’t provide a secure connection)
https://www.stefanolsen.com/ (This site can’t provide a secure connection)

K Khan
( By K Khan, 6/21/2019 8:35:21 AM)

@Stefan, Looks like your site needs some attention and isn't available to a big audience.

http://stefanolsen.com (Look out! Your Virgin Media Child Safe settings have blocked this site)
https://stefanolsen.com/ (This site can’t provide a secure connection)
https://www.stefanolsen.com/ (This site can’t provide a secure connection)

Paul Gruffydd
( By Paul Gruffydd, 6/21/2019 12:52:29 PM)

Just to pick up on  KennyG's point, I think the solution to avoiding nested blocks depends on what you're using them for. In some circumstances list properties are absolutely the right option but they also have drawbacks to be aware of in that items aren't reusable (or individually previewable), you can't apply personalisation, localisation is tricky (to put it mildly) and, as it says at the top of the documentation, they aren't officially supported.

One of my pet hates when it comes to nested blocks is to use them just to represent a containing element, for example grouping accordion blocks into an accordion container block. As well as the performance implications, this adds to the work editors have to do to maintain a site. My preferred approach in that scenario is to modify the content area renderer to look for items which should be grouped together (e.g. instances of AccordionItemBlock) and to inject the relevant markup around them.

KennyG
( By KennyG, 6/21/2019 2:01:54 PM)

Hey Paul that's an interesting approach to grouping in the content area renderer. Do you have a blog post or code sample detailing how you do that? I'd like to see that.

Paul Gruffydd
( By Paul Gruffydd, 6/21/2019 4:15:20 PM)

I'm afraid I don't have anything written up but, if people would find it useful, I might write up my approach as a blog post. If you're willing to pick through some code, Valdis takes a similar approach in his EPiBootstrapArea project here:

https://github.com/valdisiljuconoks/EPiBootstrapArea/blob/master/src/EPiBootstrapArea/BootstrapAwareContentAreaRenderer.cs

KennyG
( By KennyG, 6/24/2019 2:19:30 PM)

Hey Paul, I see you did write it up! Nice!

Jeroen Stemerdink
( By Jeroen Stemerdink, 6/27/2019 8:09:22 AM)

For more content related tips, have a look at my post here

Deepa Puranik
( By Deepa Puranik, 6/28/2019 6:12:05 AM)

Thanks for this useful checklist.

In which scenario using content area will be fine? Do we need to avoid it throughtout?

Deepa Puranik
( By Deepa Puranik, 6/28/2019 6:12:10 AM)

Thanks for this useful checklist.

In which scenario using content area will be fine? Do we need to avoid it throughtout?

Steve Horn
( By Steve Horn, 11/14/2019 3:26:53 PM)

This is a useful list. It would be very helpful to include a "why" statement after each suggestion as well as an alternative solution.

Please login to comment.