Did you notice that Image Dimensions are missing? Resolve it!

There are times when you bump in to this issues which feel like are present in out of the box version, when you are confident that it is Sitecore issue, feel free to put in a support ticket, they are usually prompt in getting back, especially, if this issue has been known to be existing.  Similar thing happened when our QA logged a bug for us which states image dimensions are missing on tree view and look fine on the other view.  See screenshot below as a reference.

Support got back in no time and here is the patch for the same if you are on version Sitecore 8.2 and above.


With Helix, it gets a little tricky to apply these kind of patches by Sitecore.  Below are the steps I followed, hopefully it helps some one who is looking for some guidance on the same.

  1. Go to Sitecore Official and Nuget sources to see if there is already a package by Sitecore, I am assuming on critical sitecore patches they would release Nuget packages to ensure folks can use from the same repository to battle their issues.
  2. In my case, the issue is minor, so obviously could not find a patch that was a Nuget, I made my own Nuget and hosted it on our company Nuget Server.  If you do not have your company one and are working with set of local developers, you could ask them to create a Local repository on some shared location and host the package from there.
    Note: Ensure your build servers also have access to that shared location. 🙂
    I added this Nuget package as reference to Common project under the project layer of Helix implementation.  Essentially, the Nuget in my case had just a dll and static javascript file that is loaded by the view in question.

That is it!  Issue behind us and we move forward to attack other fun problems.

Did you Know – A thing to do when reading from children

Super excited to post my second post on ‘Did you know’ series. This is in relation to thing/step that developers could potentially forget as they were so happy that they wrapped up a module that was complex, but, still felt super simple with help of Glass to get children loaded with exact object types they need and performance efficient and maintainable code as they parse through the list of objects only once. 🙂

How cool, right?

But, what about your content author who uses Experience Editor for them daily chores of adding/updating modules. We tend to forget them often in this busy world of making functionality. The mantra “They are the ones who use the system when you call it done and deploy the code”. So, remembering them for nth time, lol, to ensure they are still happy, do not forget to add Insert option to Experience Editor buttons that show up on the rendering. Go to your rendering that has children being read as part of implementation and add in Insert as an option to show up.

A picture is better than 1000 words, here you go:

Another problem you would need to address when you utilize children is to ensure when an item (Datasource item) is published, the children of that particular item are also published when related items are pushed. Out the box sitecore does not do that, pay close attention and ensure you customize it.

Helpful link for this publish issue:

Deep Publishing Of Related Items With Sitecore Experience Editor

Did you know – Caution on what you pass to Editable fields on Glass Mapper

Glass and Sitecore

Welcome to my series “Did you know”, I will keep posting as and when I find interesting issues and how I solved them.  This would a tiny tidbits of information which could help some one in need.  Some times you spend half day resolving an issue only to realize how petty that was. 🙂

I wish I could find a blog on each of these issues, the reason I choose to post is because I could not find a Blog or direct link to these type of issues.  Pesky little issues that eat our brains out, well, hope this helps some one.

Problem:  Very weird behavior on Glass Editable controls, specifically on looping an object, all is well when you run the debugger, but, when you actually visit the live page or preview mode the problem shows up.  On Experience Editor though things might look okay.

Resolution:  I spent hours thinking my objects are not correct, data is not loaded properly by Glass as I was mapping the children and then looping over them.  No errors on logs either.   Finally! light at the end of tunnel, the paid attention to Model being passed to @Editable Glass fields, the Engineer was copy pasting this line of code by passing it as generic X, so, it is up to Glass to decide what the object is vs we clearly stating what is the object over which we expect the looping to occur.  Once I passed in the Model using the override method of this Html control, everything starting working on all modes preview, EE and live mode.

Example Usage:  @Editable(Model, x => x.Title) //explicitly stating the model

Helpful References :  http://glass.lu/Mapper/Sc/Tutorials/Tutorial22

Hope this helps!

Thought of the day:  I am super jealous with all folks at Sitecore symposium right now, hope to join you all next year. :)

Best Practices for any Sitecore Project

With every new project, the situation is a little bit different, some times you feel like you have the whole time in the world and sometimes time is just not enough no matter what.  It depends on timeline, scope, budget and many many other things actually.

In my recent Sitecore project I am working on, fortunately I am getting enough time to craft and think about every single decision on my way.  This feels so good as I can beautifully craft a solution that is great functionally and from marketing perspective.

With start of every build phase of the project, based on team and project, I make a quick checklist for Developers and team to go over before they submit for code review.  It does not  take a lot of time, but, will go long way to ensure we are implementing Sitecore to take advantage of out of the box functionality it has got, it is important to remember why Clients chose Sitecore and ensure the set up is done right to satisfy their needs, both functionally and from content authoring/Marketing perspective.

Below is one such list and I make effort to keep that updated as the team moves towards attempting complex modules.  The mantra is to build out smaller and keep updating it based on pitfalls you generally see in your team.

  1.  Follow Technical Breakdown as closely as possible, if something should be done differently, please collaborate with Technical lead that had done the breakdown and mention the same, so he/she is aware
  2. Assume that any or every object could be null and ensure null checks are in place on your controller or business logic code.
  3. Minimize code or branching in view, in fact, we recommend to have literally no code, except for simple if statements that would check before editable/property is outputted on the view.  Everything should be available on Model or View Model that is passed and logic should reside in Controller.
  4. Create and check in all sitecore items on to project that the module or feature would need.
  5. Ensure Helix patterns and principles are followed and applied.  Technical breakdown should provide guidelines on the same as well.
  6. Do not forget to set proper Insert Options and Standard values based on functional requirements.  This is a must for a seamless content author experience
  7. Datasource and Data Template are required and is usually specified on datasource driven modules on the Technical Breakdown
  8. All fields such as pickers like Multilist, droplist or Images should be having a source assigned to ensure proper funneled content is shown to content author when trying to load content and keeping media and datasources organized and secured.
  9. Helptext, which are hints for the content author should be added when ever there is back end logic to decide on priority between two fields or specific scenario happens when user fills in a specific content field.  Talk to your Technical lead when in question.
  10. Every thing that is stated editable should be allowed to be editable and unit tested on Experience Editor, consider adding custom experience buttons / Edit frames to edit background images and pop over text when applicable. Other options could be explored if scenario could not be addressed with such easy to configure tools.
    1. If there is a drop list or a picker on content editor, such as theme selection or pattern selection, etc., consider adding a custom experience button to ensure content author could edit the same from Experience Editor.  Refer :  https://community.sitecore.net/technical_blogs/b/maximizing_usability/posts/enhancing-the-page-editor-experience-with-custom-experience-buttons
  11. Ensure your module implemented works on Experience Editor and in fact editable entities are correctly edited and saved via the platform.
  12. Ensure to upload a new image for Thumbnail for ease of use by content author and to look professional and intuitive.  Look in to document uploaded on sharepoint for instructions on how to do the same.  Document Name:  Steps To Upload Thumbnail Image For Rendering.docx
  13. Do error handling when needed and may be a back end service is being used to gather information on controller.  Use methods available on Sitecore.Diagnostics to ensure to push the error to logs, it would be helpful while debugging an issue on upper environments
  14. If there an RTF, ensure a source is set up that pulls up capabilities listed on documentation.
  15. At early stages of the implementation, I would recommend for ease of checking and testing process, the new rendering/module should have at least one set of sample content checked in and this rendering should be added to standard values of Generic Template, a new content page should be instantiated under Home node of the instance and if not dynamic data source, a specific data source should be picked to ensure when the page is accessed the module would show up on the website.
  16. Use the power of Glass to load everything you need on your datasource object or TDS Class, it is easy to extend and tell Glass what type of object you want and map it with few attributes and as simple as that, you get everything you need and controller is clean. Avoid writing code when you don’t have to.