0 Comments

image

Sitecore 9 has been just released recently and one of the biggest changes is that Lucence is no longer the default search index provider.  Sitecore 9 still supports Solr, Lucene, and Azure search as providers. However,  if you want to use a search index that work in both Analytics and contentSearch, Solr is the best option.

The article below is about to provide a step-by-step guideline, so that you can quickly spin up Sitecore 9 instance locally.

The prerequisites for Sitecore 9 includes SQL 2016, IIS 8.5+ and Solr etc. By default, Sitecore XP is secure, therefore it requires SSL enabled for Solr.

Let’s start with installing Solr with SSL enabled

image

 

Step one – Download and Install Solr

You can download from here. The Solr version is 6.6.2 (as there is a bug in Sitecore 6.6.1 as mentioned here).

Step two – generate trusted self signed certificate

Thanks to Kam Figy, who create an easy to use powershell script for automating the complete setup process of adding SSL to Solr with a self-signed certificate, and trusting that self-signed certificate. You can get the script here. Save the solrssl.ps1 onto your local. You can also find the official instruction for enabling SSL on Solr here.

In order to generate a self-signed certificate and a kay, keytool needs to be installed. If you have Java runtime environment installed, you can find the keytool under the bin folder of java installation folder.

image

Before you run the script, it’s assumed that you  have the keytool utility on your PATH system environment variable. You should be see the successful message, once the certificate has been generated and added into CA.

 image

Don’t forget to uncomment in bin/solr.in.cmd file, before restarting solr server.

SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks
SOLR_SSL_KEY_STORE_PASSWORD=secret
SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks
SOLR_SSL_TRUST_STORE_PASSWORD=secret

After you restarted the Solr, you should be able to run Solr on HTTPs protocol as shown in the screenshot below.

image

Okay, let’s kick off installing Sitecore

Step one – download Sitecore 9 package

You can download the package here. The package used for this article is the XP single package - (Packages for XP single (XP) instance configuration. Sitecore 9.0.0 rev. 171002 (WDP XP0 packages).zip).

 

Unzip the package, there are three packages included in the zip. 

image

 

Unzip the “XP0 Configuration files rev.171002.zip”, in which it contains the environment configuration files (XPo topologies).

  • sitecore-solr.json
  • xconnect-solr.json
  • xconnect-createcert.json (for developer environments)
  • sitecore-XP0.json
  • xconnect-xp0.json

Step Two – Install Sitecore Install Framework

Sitecore provides the Sitecore installation framework module, a Microsoft PowerShell module that supports local and remote installations of Sitecore, and it’s fully extensible.

Once you installed the Sitecore Fundamentals and SitecoreInstallFramework module. You can then use the PowerShell script below for installing Sitecore (Thanks to the community who created the script, it's really handy).

After the script successfully run, you should be able to see:

  • Databases

image

  • Two sites

image

Congras! Your Sitecore 9 has been successfully installed.

image

0 Comments

Recently, I’m having an issue with SXA as summarized below.  It took me quite a while for investigating and thanks to Sitecore support, it has been resolved. Therefore, I think it’s better to share it, as others may have the same issue.

Apparently it’s a bug and to track the future status of the bug report, you can use the reference number 95437

Here is the issue:

If the link field is used to wrap other fields as an example below, after user insert an link the image will disappear.

@Html.Sitecore().BeginField("Link")
  @Html.Sitecore().Field("Header Image")
@Html.Sitecore().EndField()

 

In order to get ride of the issue, you can render links with child images like:

@Html.Sitecore().BeginField("Link",new {haschildren=true})
  @Html.Sitecore().Field("Header Image")
@Html.Sitecore().EndField()

0 Comments

A few days ago, a colleague asked me about why he couldn’t access the page with preview mode, and I realized that when he was previewing the page, by default Sitecore is using the anonymous user account.  It also described here .   Apparently the bug has been resolved in Sitecore 7.2+  and to resolve this issue the new settings “Preview.AsAnonymous” has been introduced, the default value is true:

<setting name="Preview.AsAnonymous" value="true" />

So, if the value is true, Sitecore uses the Anonymous user when one previews an item, otherwise, Sitecore uses the current user account.

0 Comments
  •   Posted in: 
  • SXA

Since Sitecore releasedSitecore Experience Accelerator, there has been has a lot of discussions around why businesses that currently use Sitecore, would need SXA, and how SXA can speed up the development process. In my previous post I talked about how to create a custom SXA component. In this post, I’m going to share my experience with building a website using Sitecore SXA.

 

why SXA is good

SXA allows for the designers, UX and UI teams to work with the developers

In the traditional process, wireframe, design, front-end and back-end are working in sequence as shown in below diagram.

 

image

However, SXA gives the possibility for UX, Design, front-end and back-end to work in parallel.

image

 

SXA force best practice principles

As mentioned above, Sitecore SXA was built with Sitecore Helix framework in mind.  Developer can extend and customise the SXA features, however,  the same framework and principles have to be followed.

 

Reusable components

You may be thinking , but I can create component in traditional Sitecore solution and make it reusable already!  Why call out SXA?  This can be best answered with an example.

The below is a design example, and I believe as Sitecore developers, we will all agree that the circled widget is likely to be a rendering with a data source applied?

image

 

However, this would not be the approach you would talk with SXA! In SXA we define an individual column as a component.  According to the design, we will repeat the same component three times. Sitecore SXA has pre-built renderings(component) which can help us understand the principles and which we can utilise; These can be found here

In this example, the rendering we will want to re-use would be the Image (Reusable) rendering (component)!,  this means no custom rendering is required.  You just saved yourself some Back-end dev time, integration with front-end, and testing! 

SXA can significantly speed up your development process!

image

 

Building a website with SXA

Prepare SXA solution

Setup Sitecore solution by following Sitecore Helix framework.

Here is the sample structure

image

 

Define your renderings

As explained above,  in SXA when we are trying to define the rendering, we want to keep it small so that we can easily reuse it across the site.

The below is an example design for a quick links rendering (component).   Instead defining the whole panel as a widget/ rendering with data source,  we can use Image (Reusable) rendering and take the advantage of SXA rendering styling feature.

image

 

Here is how you can create a quick link rendering (in10 minutes).

1. Add  a container rendering

image

2. Add  an Image (Reusable) rendering into the container

image

 

Once you done this, it basically means you have a div wrapper for the image (Reusable)

<div class =”component container”>

..

[Image (Reusable) Rendering]

..

</div>

In order to make the image (Reusable) rendering have the same look and feel as per design, you may need a custom style.

Under site presentation, I created custom styles (I don’t want to mess with SXA styles).  I believe its important to keep the out of the boxes styles separate from out custom styles.  SXA also allows you to select allowed rendering per style.  In our case above, we are going to create a new style called ”Quick Links, and in “Allowed Renderings” select container rendering.

image

 

After that, you should be able to see the custom style in the Styles property window

image

Once you’ve done, I’m sure your front-end can do the magic to make it pretty as per the design.  easy right?

In some cases, you may need to create your own renderings, you can read my previous post about how to create custom rendering here.

 

Page Designs

Page design is defined in your project scope which is the number of page templates you are going to build.

 

Partial  Designs

Partial design is one of the beautiful design principles with SXA, where you would normallyhave presentation details defined (against standard values), SXA separates and moves these to site level. 

Partial design has the same concept of MVC partial views. SXA allows you to select multiple partial views for a page design.

 

image

 

Export/Import the site

Once you finish the page design, you can then export either a single page or the whole site, front-end developer can start to re-skin by creating a custom theme.

SXA stores all themes in media library. After restyling is completed, you can reimport these into Sitecore and SXA will automatically create new css and javascript accordingly in media library.

 

image

 

After successfully reimporting the site,  congratulations! you’ve done your first SXA site.

image

 

If you would like to see a live demo, please join the August Meetup of the Sydeney Sitecor User Group. Click here for RSVP.

0 Comments

In my previous post, I explained how to create custom facets and store them in xDB. In this post, I’m going to show you how to display custom facets in Experience Profile.

Experience profile lets you monitor the behaviour of contacts that have interacted with the website. It allows you to search a specific contact, either via either name or email. 

If you click on the contact, then you will be able to view the contact profile as shown in below.  This is cool right?!, however, you may find that Sitecore does not automatically display custom facets. 

image

In order to to achieve this, custom code is required. Therefore, I’m going to show you how to create a custom tab in the contact profile and display custom facets step by step.

STEPOne – Create custom facets

In my previous post, I’ve created a newsletter subscriptions facets and stored in xDB.

image

However, creating custom facets is not the scope of this post, if you want to learn how to create custom facets, you can refer to my previous post here.

STEP Two – Create Web API for retrieving the facets by contact id

This is much like any other WebAPI you will have created, and I would recommend applying access restrictions to the API for security reasons, you can apply Sitecore’s existing security filter called AuthorizedReportingUserFilteruse, which is defined in Sitecore.Cintel.dll.

Here is an example code:

 

Once you complete the implementation of your API, the next step is to register the API in route.

image

 

STEPThree – Create SPEAK script; this will call our API

  • Firstly, I’m going to create a folder called “Subscriptions” under /sitecore/shell/client/Applications/ExperienceProfile/Contact/Subsriptions
  • Next, I will add subscriptionsTab.js and subscriptionsTab.css under the folder. (as shown as below)

image

  • Associate the created CSS in core database

you will need to add style item in core database and point at the css file.  The defined css will be loaded automatically, when contact profile page is loading.

image

  • Associate the created JavaScript in core database

In this step, I created a new custom Tab, called “SubscriptionPanel” and PageCodeScriptFileName is where you should associate with the JavaScript we just created above.

 image

In order to verify what you’ve done so far is correct.  you should be able to see the new custom tab “Subscription”, and  both subscriptionsTab.js and subscriptionsTab.css are loaded, after contact profile page is loaded.

image

The next step is to write a script for retrieving the data via the custom API you created above. Sitecore use SPEAK as a framework for developing Sitecore application with a consistent interface.  The syntax is very simple to follow and extend.

Here is the sample code for calling the API and return Json.

STEPFour – Binding Json object to the controller on the custom Tab

The last step is to display the Json data on the custom Tab.

In the above code snippet,  you will find this code cintelUtil.setText($that.WhatsOnValue, jsondata.WhatsOn, true);.  this sets TextBox “WhatsOnValue” within the controller, so it contains the Json value.  Then, the next question is how to define the “WhatsOnValue” textbox in Sitecore?  Don’t fret, I will show you how this can be done!.

  • Add Text rendering (Note: because I’m using SPEAK 1.1 framework,  I will have to select the Text rendering under SPEAK 1-1)

image 

  • Set the ID to “WhatsOnValue”, this is the ID where the cintelUtil.setTextto function is referring to.

image

Congratulation!! you’ve done all the code and configuration.  Now let’s check out the result,  The “subscriptions” tab should display in the contact profile page as well as the custom facets associating with the contact.

image

Hope you found this post is useful, and enjoyed this article.