Sitecore 9 Installation, My Quest to not give up

I know, I am super late! It has just been a super crazy month on my end due to typical deadlines and crunch times, but, would like to post this before we get on to more awesome things in the coming future.  The speed at which we are racing,  within next two months, I believe Sitecore 9 and anything to do with it would be called essentials. 🙂

I had made a note on my last blog here that I will update every one on one unique caveat and many more known devils I had faced while getting the taste of latest and greatest.  Now, below are the my n different things I had to do to see the beautiful lady on my favorite browser and oh boy! I hopped with joy when I finally did see her.   She looked more gorgeous than ever and yes, I knew I was in the game when I got a glimpse of her.

While I was hitting so many problems and walls, there were so many blogs and findings that helped me debug each and move forward.  Beautiful community!
Except for one issue that stood strong between me and my new toy, just in case if you run in to this, hopefully it will help you and save few pesky hours of debugging.

  1. I used the most favorite and easiest way to get Solr up and running on my local by running a pre-made script noted here – https://gist.github.com/jermdavis/8d8a79f680505f1074153f02f70b9105
  2. Had to get my SQL 2016 as that was stated as a pre-requisite and wanted to ensure I do not miss any thing
  3. Also, ensured I get latest version of powershell by installing updates and patches on my windows.  Those things you put off because you simply do not want to restart your computer. lol, I repented it like always.
  4. Also, ensure you have everything noted up on pre-requisites in installation guide.  Sitecore is not being funny and yep everything noted here is indeed a pre-requisite and is needed including modification of any registry entries to avoid some super weird SQL issues.

Now, after I did all this and followed through a lot of blogs, I still could not overcome one final error on my end on running the powershell script.  I failed and tried again like I do not remember how many times and I also kind of lost count on how many hours I had spent googling if I missed anything else.

Below, was the error I was seeing on the powershell.

“Xconnect windows service fails to start”

My first thought based on many reads was my license file is not legit and is not authorized to be used with Sitecore 9.0+.  And that is what I saw all over the web for an error such as above. But, after I heard from some one else who used exact same license as I did was successful in setting up the site, kind of huge burst of a bubble there, I could literally hear a pop.  I went to event viewer and checked all the errors, I could see a message that license was accepted, so, that was not it.

Now,  I was at verge of giving up as I was totally numb and super freakishly tired.   I am obviously doing something very silly, just could not point what.

While browsing the community, forums, blogs for similar errors, I did find one clue that helped me realize what is it that xconnect was not liking and hence not starting causing the powershell to crash on me.

https://community.sitecore.net/developers/f/5/t/8398

On this thread here, something caught my eye, though this was not the issue I was having on hand, it was worth the shot of running service manually to see if the error on command prompt does give some insight on what the issue is. So, I went to the location where exe is located on my inetpub and gave it a whirl.  I saw an error message relating to format exception on Solr URL.  Crazy right! I did check to ensure my solr url I had configured quite easily on my step #1 is correct.  But, why does it not like it, so, when you configure Solr and try to browse to the url, it actually appends a hash to it by inherent redirect.  That was the URL i had copied to my install script.   It looked like – https://solr:8983/solr/#/

Apparently, xconnect service does not like the url of such format though it is actually a working Solr url. So, pay attention to your url of Solr on PS script. It should look like
https://solr:8983/solr

Once, I did this all was well and I could spin up a Sitecore 9.0+ site on my local.

Hope this helps some one else for easy way of debugging such type of issues!

 

 

 

24 Hours

24 hours

This has been long due and would like to share my hackathon experience before the memory gets a tad bit weak.  First things first, I must say that I handled the competition with way more ease than first time around.  Who ever said it, yes, it is absolutely correct that “Experience does makes you perfect”

I tried to remind myself and my comrade multiple times that hackathon is only an implementation of scratch of the surface stating the future to explore further.  If you loose this thought, you will find yourself being extremely fatigued and will end up doing bunch of mistakes and miss prerequisites.

The goal is to shoot for stars, but, also, ensure you have a clear picture on what you would call a deliverable.  All in all it was fun and calm for the most part with brain juices flowing pretty well.

You can read about what we did and how we did it – up here.

https://github.com/Sitecore-Hackathon/2018-Witty-Geeks/tree/master/documentation

There is a little video we made as well as a proud participants, but, tired ones. 🙂

Here you go – https://recordings.join.me/H8TFZihidUGXBwppem5_pw

In my next post, I wanted to share my Sitecore 9.1 installation experience with SIF tools and all the pitfalls I bumped in to, luckily there was a blog for most of them.  Of course, I had one unique one which might help some, so, will post that soon.

Cya later!

PS:  If you do not know what hackathon I am talking about, see the details below.

http://www.sitecorehackathon.org/sitecore-hackathon-2018/

Sitecore Image Optimization

Optimize Images

Time and time again you see yourself solving an issue or providing a solution to a problem that seem to exist regardless of breadth of solution.  One such problem I noted on my clients is Images, no matter how advanced the actual sitecore implementation is, for some reason Images and their handling are not taken seriously enough.

On the projects where I am leading the technical effort, I almost always ensure and push the team to think about this because when we launch the site, it is sure very important to get the functionality right, but, what is also important is to ensure tools like Google page speeds and others out there give your effort a good ranking.  You might say, well it is just a number, but, it is important to understand the number is mere representation how fast and efficient your solution is and hence the numbers and issues are important.  At the end of the day, you want to see your website where you put in so much effort and money lands well on Google. 🙂

I am a true believer that we should never be re-inventing the wheel and always see where we can get with couple of smart solutions out there that folks use for this very purpose.  I toyed around with couple of options and compared them on different aspects, so, we can make a decision on next steps to get us where we would like to be.

Below are my findings on this comparison.

Note:  I am not supportive of either of these options I researched and only providing my thoughts around it.  Not meaning to offend any one or praise any one either.  🙂

Please leave a comment if you have any more thoughts or options that could prove to be useful.

Tools investigated are:

Dianoga – https://github.com/kamsar/Dianoga/blob/master/README.md

Image Crunch – https://github.com/1508/SitecoreExtension.ImageCrunch

Comparision Sheet between the favorites

DianogaKraken Based API calls
Installation and Set upWorks OOTB, no need to tailor or modify unless very specific needs arise
If CDN is in play, additional configuration might be needed. See some more steps noted for CDN set up here:
https://github.com/kamsar/Dianoga
We will need to test with CDN in play to ensure it still works with this additional steps
• Would need some honing as module does not seem to be perfect and need some issues to be addressed. See Git hub notes by me to the author –
https://github.com/vishalniit/InSitecore.Sitecore.ImageCrunch/issues/1
• API keys based on subscription for Kraken
Custom CodeNot needed for optimization specificallyWill be needed more than likely to ensure we tailor the solution to our needs. Can take reference from the module suggested and make it our own.
SubscriptionFreeMonthly subscription needed
https://kraken.io/pricing
Google Page SpeedStill few images not compressed to what Google expects it to be at.
But, I came to know that Dianoga works it's best with scaling parameters, so check that out if your implementation does not have scaling in place.
Compression respected by Google algorithm
Served FromMedia Cache
Image should be available on media cache which is based on request to the resource, so, optimization is on-demand
Media Library
Hook is on media library, so, every time a new image is uploaded or attached Kraken is called to Optimize the same if needed.
For existing images, there are few calls we can make right from content author ribbon.
Publish would be needed to ensure optimized images are being served upon request
Cache should be cleared if not already in play on CDN to ensure newly optimized images will be served

That is it you guys, hopefully this helps some one looking for a solution to optimize their Sitecore imagery.  Both of these options are unique in terms of how they deal with the problem on hand.  Ultimately, both seem to be good, so, picking an option would be mainly based on business and development teams preference based on their implementation.

Maneuver crawler to your will

control

I was reviewing one of our client websites and found few issues which are considered to be SEO pitfalls.  Would like to share this, I am assuming that most of us already know this, but, in this myriad of things we need to keep a tap on, it is almost necessary to remind ourselves just how important SEO aspect for the website you will build actually is.   Sitemap is almost an inherent choice and much needed one to submit to the search engine giants in some way or choice.

But, it is essential to remember what not to push to sitemap as crawler is busy doing it’s thing and indexing every bit of your fresh content as much as it can.   Few things to always remember –

  1. Ensure to not add any urls that either do not have any content or could lead to 404.  This is very essential to make sure we are not asking crawler to even for a milli-second think about pages that are not important and this will help ensure you don’t set up your own pitfall towards having a red mark on Google for instance.  You can do this by providing a way to either exclude content or templates when sitemap is being generated, easy enough.  But, is often missed. 🙂
  2. Now, if you are using any folders or intermediate content for just solely organizational purpose, ensure you have proper redirects in play to make sure if some one is either being smart or received an improper url, your set up does a terrific job of placing the end user where you wish him/her to be looking at when they pull up your site.  Magic, yeah. lol.  For the other side of users which is your content authors, ensure you have proper insert options and templates filled in with beautiful presentation that would then take care of all in the background keeping content authoring simple and easy peasy.

You do not have such fancy sitemap generation on your sitecore instance? Look the following options which are my favorite.  Setting these up should be real simple, but, as always tricky part is maintaining the solution and training some one who uses it to know these things that they can do to keep crawlers in check.

References / Suggestions 

https://marketplace.sitecore.net/Modules/S/SitemapXml.aspx

https://marketplace.sitecore.net/en/Modules/XML_Sitemap_Generator.aspx

https://github.com/JimmieOverby/SitecoreSitemapXML    — My Personal Favorite with more customization

Tons of other modules on market place, explore more:

https://marketplace.sitecore.net/SearchResults#query=sitemap

Sitecore Sharing! Same Same, but, Here There

wild card

Happy New year to one and all!  It is always an awesome feeling to welcome the new year and leave behind what was done in previous year in memories. The beauty of memories, they can be good, bad or worse and everything in between, but, regardless, we are set to move forward to make new memories this year, new learning and potentially reach new heights. 🙂

I was waiting to find perfect topic for my first blog this new year.  I think I just found one, so, I was working for one of our clients who wanted to see, how many options do they have to share content across multiple sites on a Multi site single sitecore instance.   They currently use wildcard mechanism with multiple sites configured to have different root paths, but, the content resides in one area regardless of which site the piece of content belongs to.

Why would they want to see other options is that they strongly believed that content structure they use the problem for performance issues, which, well could be legit as a risk that comes with meddling any pipeline while not being cautious.

Below are the three options I could find from brainstorming, research and asking other folks to top off the wild card approach they already have in play.  Do you all have any other options that you have used in the past, if yes, would love to hear more.  Drop in a comment!

  1. Hybrid tree approach :  This is basically going with shared root path approach if the page tree is consistent and is exactly similar.  If the page content is going to be different, then, for that specific site configuration you will need to define a different root path and main content in a separate tree altogether.
  2. Clones:  I have seen many old implementations that would go this route in shared content situations, but, struggled a lot with intuitive changes and workflow, publish issues faced by content authors.
  3. MVC Routing :  If your application is using MVC, then, this could be one decent solve instead of wild card and ten other pipelines being affected to support wild card.  Note though, when using some of this as an experiment the routing code was literally running for every module when a breakpoint was placed.  Pay close attention to where this logic is being run and how performance efficient this is.

Archive/Restore Options for Sitecore

versions

There are many legally obligated companies that would still pick Sitecore for it’s immense power and flexibility that comes out of the box and the constant push towards reaching marketing goals is one of the other main reason why.

The biggest challenges they are facing currently is the legal battles these heavy financial companies face to maintain old/stale data for compliance reasons.  Even if they have a third party crawler of some sort that would capture screenshots of how sites are rendered at scheduled times, due to Personalization and other contextual driven content, they do need some way to tap on to all history and can not risk loosing it for Audit purposes.

I have seen some clients that kept storing all versions in all languages which would lead to bad performance of content editor and slow content authoring experience.  Sitecore recommends not more than 10 versions to be stored on CM side.

I have been researching to find few decent options to steer them to correct path which is to trim their versions.  I must say that I could not find next to none which are robust and easy to use, especially that utilize Sitecore Archiving instead of Serialization to a item file on file system.  I sure found couple blogs and references to build something, but, it would be nice to have feature which would be harnessed and appreciated by most of the audit heavy clients.

Would love to get some feedback and tools you all typically use for Archiving the outdated Item versions.  Do note that this should work on a load balanced CM environment. 🙂

Looking forward to hear any feedback on this, I currently, based on research out there found three options overall and I am listing down pros and cons on each.  But, if any of you know more, please reach out.

Option 1 – Manual Route

Sitecore provides manual way for content author to archive versions on need basis and there is a UI that could be utilized to restore the version of choice.

https://doc.sitecore.net/sitecore_experience_platform/82/content_authoring/managing_items/general/archive_and_restore_an_item

Option 2 – Custom with a Twist

The Guru, John west, has a blog that is neat and could help with a solution that could be custom built.

https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/rules-engine-actions-to-remove-old-versions-in-the-sitecore-asp-net-cms

Also, I did find a module that took inspiration from option 3 that is coming next and blog provided above, but, unfortunately it does not support multi-lingual at this time and customization would be needed to be able to use the same.

Introducing the ‘Sitecore Version Pruner’ shared source module!

Option 3 – The Legacy Module (Version Manager)

https://marketplace.sitecore.net/en/Modules/Version_Manager.aspx

If you have ever read through performance tuning document, Sitecore did recommend on versions 7 to have in version manager to help mitigate number of versions.

FYI, currently due to lack of time, the module is not being actively maintained per author’s comment, but, it could be tested and utilized if your business demands are satisfied.  But, do note that this uses file serialization mechanism for restoration and archiving, so, it would be tedious to restore and not as straight forward as Archiving that is possible on later versions of Sitecore.

 

I had created sitecore support ticket to find out if there is more that I can quickly go ahead and use and the answer was no, so, they created a feature request, would love to get this ticket escalated.  If you wish to track it, here is the number – 198728

Did you know – Broken links report considers all versions

broken

As soon as I come across some thing new and is a small piece of info, but, could be useful, I can immediately think about my Did you know series.  This would be a latest addition to the pile.

Interesting piece of information that I bumped in to yesterday while running Broken Links report on a huge database  and sitecore instance that has many versions on CM side of things in many different languages.  When I run the broken link report, there were huge number of items listed on the report and I randomly picked bunch of those to check more deeply.  Most of them were outdated and old versions.

I immediately thought there should be a way to force Sitecore not to consider old versions when running broken links report.  Unfortunately, there is no way to do so currently.   When I dig deeper in code of kernel, I did see the default is to consider all versions.

Code versions

I got a feature request logged with sitecore if you like to track it, here is the reference number – 178492

If you really need this feature, then, the only other way is to build your own Speak View and scanner that could be custom function to grab only the latest version of each item in each language to keep the list to what you really care about. 🙂

 

Allowed Controls Issue Fortis Dynamic Placeholders

Fortis Nuget

I know many folks out there love and use Fortis Dynamic Placeholder either via Nuget or in package form.

The following link provides some information and background about what it does.

http://fortis.ws/fortis-collection/dynamic-placeholders/

While picking a dynamic placeholder support for my 8.2 Sitecore Instance I did a lot of research to see and weigh my options and picked this as this has been actively used by many of Sitecore enthusiasts.  The hope was it will be seamless and easy to use.  It was both of these on many levels and so far was working fine for our requirements.

On this specific implementation of Sitecore, we do use a lot of modules with placeholders for re-use and ease of dropping different type of content within the parent wrapper for instance.  It gives immense flexibility and power when done right.  I was skeptical that we would potentially run in to an issue or two, but, was also confident that this module is backed up by Habitat as well along with about 60k downloads on Nuget that any issue could have a potential solution.

Issue :  When you have a placeholder within a Dynamic Placeholder , this inner placeholder could be a sitecore one or dynamic one, incorrect allowed controls were showing up on Inner placeholder.   It was actually pulling allowed controls of parent(wrapper) instead of inner placeholder.

Steps to resolve:  I decided to approach the channel and folks I know who love/recommend Fortis, unfortunately none of them yet encountered this issue of mine.  So, I decided to debug further.  The issue is in the patch that the module does before Sitecore.Pipelines.GetPlaceholderRenderings.GetAllowedRenderings to get the allowed controls of placeholder based on regex match and add it to list of renderings.  For this patch, if you use dotpeek or reflector, you will notice the below lines of code :

Match match = new Regex(PlaceholderKeyRegex.DynamicKeyRegex).Match(placeholderKey1);
if (!match.Success || match.Groups.Count <= 0)
return;
string placeholderKey2 = match.Groups[1].Value;

What this does is get the match from the args placeholder key that Sitecore pushes in to see if this is a dynamic type of placeholder and if it is, it tries to look in to groups to find the value and correspondingly get the Allowed Controls on placeholder in question.  This is an issue because it is by default picking up the first match and not considering the most inner match possible.

I revamped this piece of code to use Regex match collection instead and pulled up the most inner one available and that seems to do the trick.  I will attach the fix below for your reference if you are curious.  I left rest of the code untouched to ensure I introduce no bugs. 🙂

Note:  Still under testing and not been shipped to live site, so, use this with caution.

Regex regexForPlaceholderKey = new Regex(PlaceholderKeyRegex.DynamicKeyRegex);
var allMatchesOnPlaceholder = regexForPlaceholderKey.Matches(placeholderKey1);
Match match;
if(allMatchesOnPlaceholder.Count > 0 )
{
//Always get the highest match, last match as that would be needed for allowed controls
//If there is just one matcg it should still get the first one
match = allMatchesOnPlaceholder[allMatchesOnPlaceholder.Count-1];
if (!match.Success || match.Groups.Count <= 0)
return;

After you change, ensure you patch your config to your updated code for this specific pipeline process code. Observe caution when you upgrade Fortis Nuget version for instance in the future before swapping the config file.
If I were you, I would test the below scenarios post change to ensure all is well.  Go to experience editor and click on Add Here on each of the corresponding cases in design mode.

1. A simple sitecore placeholder
2. Sitecore placeholder inside a parent placeholder
3. Simple Dynamic Placeholder
4. A Dynamic placeholder inside a Dynamic placeholder
5. Sitecore placeholder inside dynamic placeholer.
6. If possible/existing use case – Dynamic placeholder inside Sitecore placeholder

Hope this helps some one like  me. 🙂
Logged an issue on git hub page for this Nuget reference as well.

https://github.com/Fortis-Collection/dynamic-placeholders/issues/3

Did you know – Paas does not support Lucene

So psyched to share this quick piece of info, this is my first time working with a fully Sitecore Paas infrastructure, so, getting to know it more intimately.  I did know that Sitecore Paas comes with Azure Search and Redis cache for instance, but, what I did not know is that Lucene is not at all supported which means that all Lucene related config files were actually disabled on the upper environments that were set up with help from Sitecore.

Reality hit me hard when trying to set up a computed index field that worked beautifully fine on my local, but, completely broke on upper environments.

So, folks out there if you are using Paas pay attention to the index configuration and ensure all the steps listed below were actually completed thoroughly on your Paas  sitecore servers.

https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/configure_azure_search

Two quick follow up questions that would come to mind, how do I know which type of Search Indexes are used, this is the simple one, look at showconfig.aspx to see what is listed under Index configuration which defines type of Index.

Index Info

The second one which is more important when there is custom search/Index based functionality is, how to ensure locally too Developers are using Azure based Indexes and not Lucene based one’s?  Would love to hear from every one who has experience on this.  This would be an open question for now, hoping to resolve this based on feedback and would potentially reach out to Sitecore to understand what do people generally do for Development in this case.

Happy Sitecoring and hope you are all enjoying your holidays!

Sitecore Shared Content Issues

On the day one, when I started my blog, I made a promise that I will share good and not so good side of Sitecore.  So far, did not find anything that was very counter intuitive up until now.

One of the main purpose of CMS is to share a piece of repetitive content so you are not changing something in ten different places when there is a need for change, you change one single datasource item that is shared across multiple pages and all pages will reflect the change when the datasource is pushed live either via a workflow based approach or through some kind of publish.

But, the stinky part is that when this specific datasource is shared across multiple pages, all pages will be in some sense updated, but, are never thrown in to a workflow of any sort, they just magically are updated on live website.   In many heavy compliance driven environments, it get’s super important to track when a page or any content living on the page has changed.  With current inherent behavior of Sitecore, there is no way to track when a page truly changed due to datasource driven modules and how the page and datasources are disconnected for many good reasons.

When asked, Sitecore mentioned that this is possible to do so by tapping and finding related items of the datasource and doing something with those layered related items.  It just seems surprising to me that this is not something that is available out of the box.

Below are few references I read up while ensuring that I am not some how dreaming or in an illusion and that Sitecore does support this behavior.  Sitecore confirmed that, nope, the page items that use a datasource that has been modified do not go through any workflow and will not be published.

https://doc.sitecore.net/sitecore_experience_platform/content_authoring/creating_and_editing_items/editing/manage_associated_content

Suggested approach is that you use the Link database and get all references as stated above which per me seems to be expensive operation especially if you do not have a workflow set on datasource templates for instance.  In which case, you will already be pushing all datasource templates as true related items when a page is published.

I would love to hear what others do in situations like this.  This feature when implemented could come in handy in many situations with all clients that are more Compliance driven due to legal aspects of the site and information they would need to track.

Example of sample approach to read from Link database is below.

https://laubplusco.net/sitecore-item-extensions-get-referrers-as-items/

 

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.

https://sitecore.box.com/s/ecmo5ybmsmeoshbd8t6o2xidwcc8n383

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. :)

Performance is the Key

Imagine yourself building an excellent functional website, but, it does not load fast enough, would people actually use the awesome functionality you pulled off.  The answer would be no! People are impatient and busy with their hectic lives and they would not care to wait 3 seconds that the functionality might take to load.  So, performance is a balancing act to make wise decisions when coming to impeccable functionality.  Asking the right questions and following the best practices around everything as much humanely or scope wise possible is the way to to go and key to success.  In the past, i did write a blog about performance gain in few steps which was more web site page load speed driven.  You can see it here

A different paradigm to bump up your site performance

This time around, I will highlight few key things you could do in improvising your Content management experience.

When building a sitecore site, considering the routine and daily chores of content author are the most important to ensure we are using full potential of what Sitecore has to offer with it’s platform.  But, often times this is forgotten along the way and more attention is given to how the website looks, feels and functions.  It is important to ensure the content author experience is still taken in to consideration while pulling off an amazing looking site.

Couple things to keep in mind while coming up with Architecture and Sitecore content structure for the site –

  1. Placeholder settings
  2. Insert Options
  3. Experience editor support
  4. Available renderings
  5. Compatible Renderings
  6. Standard Values

I will drill more on to how each of the above when thought and configured correctly would be of great help to ensure content author has seamless experience.  For now, jumping on to performance.   I have seen many folks complain that their content authoring is slow and sometimes take a while to load.  This could be due to customization done, but, we should not forget to try the below things first to ensure we have basic foundations covered.   They do not take long time to do, but, could be that it is often given least importance because again end user experience is given more weight  than content author experience. 🙂

Below is the drill that could be done to instantly bump up your content author experience.

  • Clean up Databases :  It should be either done regularly via control panel or a script that could be scheduled to run from SQL server to help mitigate performance issues.
  • Maintenance Plans: Sitecore performance tuning guide screams that this is important, it is simple to do, but, I noticed this is almost always ignored and not done.  This is important and critical for content authoring performance
  • Ensure there are less than 100 items within a node, this is a best practice suggested by sitecore, so, the content author does not click on expand and wait few seconds before he see’s the list load.
  • Few critical settings that could help content tree load would be those mentioned on performance tuning document, below are the two for reference, both have good gain of performance
    RenderCollapsedSections
    CheckHasChildrenOnTreeNodes
    Check tuning guide for more information:  https://sdn.sitecore.net/upload/sitecore7/70/cms_tuning_guide_sc70-72-usletter.pdf
  • Limit number of versions: User version manager to ensure you have upper bound to number of versions on your implementation.
  • Ensure workbox and draft versions are cleaned up frequently for better maintenance and quicker load.
  • Clean  up broken links
  • Rebuild your indexes
  • Use publishing service if you are on newer versions of sitecore.
  • Go cloud – So, nearest available node would serve the content avoiding any network delay
  • Ensure you set cache limits and not use limitless cache option that sitecore provides on CM
  • Check your logs for any errors and fix them.

After doing all the above, if your content authoring is still slower then look into any overridden code in Sitecore pipelines and do some performance tests.

Happy Sitecoring and Have a great weekend!

Custom Sorting on Coveo Facet

I got to use a new feature of Coveo today because of new requirements. How fun, though the request that came through felt not needed and a corner case in terms of user experience. Pushing through limit is what we have to do if you have got super picky clients. 🙂
The outcome is always precious as you get to learn something new. Here is the snapshot of what happened and how we were able to get it working per request and requirement.

Goal – Regardless of selections made on Coveo Facet because of url appending, the sort order of values available on facet stay per the field on which sort is based on.

Problem – The inherent default behavior of Coveo for better UX experience. To be honest, I actually like what they have in terms of grouping the values selected to the top and rest are sorted based on the sort field set up. But, we have to some how overwrite this default behavior.

Firstly, our front end contact explored why this happens and how coveo groups them the way it does inherently. The reason for special attention that these selected values get is because of the below. Thanks to our front end resource to find this out. Though we did not pursue anything in modifying this, it is always good to know the reasons behind how it is currently done.

https://developers.coveo.com/display/public/SearchREST/Group+By+Results

So, the reason is that when there is an appending in URL for a selection of a value or set of values in the facet, Coveo inherently tags these as Desired and hence the special treatment for those to be on the top.

For example, if your URL is like below may be because the user clicked on back button post user selected few values and moved on his journey, the user could land on pages like this or if marketing team linked off the user to a page with pre-selected values on a facet.  There could be more scenarios where your user would bump in to this situation, but to name a few.

Example URL – https://www.domain.com/press-releases-events-and-webcasts-landing#f:articlePostYear=[2017,2018]

The selected would be grouped on top like below due to the above explained reason.

Again, I like what Coveo does inherently and I suspect that this needs to overridden in simple cases, but, if you absolutely need to do this? Which is where we stood, I logged a Q and A below and luckily got a direction.  I only wish there were more graceful options, but, we took what we got as well, we had to overwrite this and there was no other option unfortunately.

If you are curious, follow the discussion here and I will explain more in detail how I actually implemented what was recommended by Coveo team.

https://answers.coveo.com/questions/12071/facet-values-mentionedgrabbed-in-allowed-values-be.html?childToView=12086#answer-12086

Steps I did to Implement this solution:

  1. Created a copy of default Coveo MVC view for facet and named it differently and placed under correct project specific location.
  2. Add the below line to the view created just above end of div tag in place for the facet
    data-custom-sort=”2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014″>
  3. Note – With addition of this, we should be good on sorting with lower limit of 2014 to upper limit of 2014, based on your project data you could decide on good numbers for these limits. Only deal is post 2024, if this project has same implementation, we will need a code deploy to ensure sort works as expected.
  4. Use this new view item on presentation for the facet and select all appropriate values that a coveo facet would need on the templates affected or will use such type of facet
  5. That is it!! Post this change regardless if values are selected via url or not, the ordering will be based on data-custom-sort.