Node.js

Node Module to Retrieve Multiple Parameters from AWS Parameter Store

I created a node module to retrieve multiple parameters as the parameterName-parameterValue Json object from AWS Parameter Store. It is called aws-ssm-parameters and is available from Npm. The module is namespaced. So, you need to add the namespace @mdhnpm when you install it. npm i @mdhnpm/aws-ssm-parameters The main motivation for creating …

Sitecore

Creating DbItem with Item ID – Sitecore FakeDb

With FakeDb, we can mock content items. Each tree node can be created by the DbItem class. DbItem class has three constructors as below. public DbItem(string name); public DbItem(string name, ID id); public DbItem(string name, ID id, ID templateId); When your code is calling GetItem with the Sitecore.Data.ID object, you …

Sitecore

How to Troubleshoot FakeDb Errors – Sitecore 8.2

A NuGet package, Sitecore.FakeDb helps us to test functions that use Sitecore API. It is a mock memory database where you can remove the dependencies and isolate the code. When you create a brand-new test project, setting up FakeDb can be tricky. Installing FakeDb and adding the usual two Sitecore …

Sitecore

How to Mock Rendering Parameters in Unit Test – Sitecore

Now that we created a cool components with rendering parameters (see Using Rendering Parameters to Inject Data into Hidden Input), we can write a unit test. Sitecore’s Rendering class has a publicly accessible string field called Parameters. This is the rendering parameter string get populated on page rendering. Mocking is …

Sitecore

Using Rendering Parameters to Inject Data into Hidden Input – Sitecore

What are rendering parameters? They are the additional key-value pair data you can feed to the Sitecore component in addition to data source. The textbook example would be adding an additional CSS class to the component. Content authors can customise the style of the component, like background colour or button …

Sitecore

How to Set up Content Tests with Data Source – Sitecore

Setting up AB tests or even multivariate tests in Sitecore is simple as long as the page is implemented correctly. The key to easily create AB tests is to components. There are a few ways of setting up tests in Sitecore. In this post, let’s create tests by using data …

Sitecore

How to Configure Custom Goals and Trigger them by AJAX Call – Sitecore

Sitecore has out of the box capability to record customers’ behaviours throughout their journey across the channels. We can customise the way to capture customers’ behaviours by registering our own custom events, failure events, goals and outcomes and use them to create personalisation. This out of the box analytics capability …

Sitecore

Using Data Source in Controller Renderings – Sitecore

Data source for Sitecore component provide data points to be used in the components, such as controller renderings or view renderings. Content author can easily edit those data points (e.g. header title, body text or CSS style) to customise components. It is one of the techniques to make Sitecore component …

Sitecore

Styling Folder Template in Content Tree – Sitecore

Creating a visual reference for Sitecore items is important for content authors as well as developers. The recommended practice (or I would say mandatory) for creating an template is to assign a distinguishable icon for easier visual reference. If you know this trick, you can go one step further to …

Front-End

Using Lexical this in JavaScript Class Method with ES6 Arrow Functions

The way JavaScript handles scope is unique. It makes the language so fascinating to learn. It is so different from any other major programming languages. JavaScript has many quirks that make it so fascinating, such as its asynchronous nature, event loops, prototypes, closure and so on. I think this is …