Tagged: Sitecore

Coveo Computed Field for Retrieving Page Content and Renderings in Sitecore

I needed to index all text from the page content and its associated renderings, including single-line, multi-line, and rich text, into a single Coveo-computed field.

Let’s get started.

Text Extraction:

  • Created a TextExtraction class that inherits BaseComputedField.
  • GetComputedFieldValue: Computes the concatenated text from the item and its renderings.

  • GetRenderingSource: Retrieves the source item for a given rendering reference.

  • GetDatasourceItem: Resolves and retrieves the data source item using the pipeline manager.

  • GetAllReferencedText: Extracts text from fields and adds them to a result list.

  • GetReferenceFieldData: Handles reference fields and extracts text from referenced items.

 

 

Configuration:

Let’s add the TextExtraction computed field into the config file.

 

I published all the files, and it’s time to check.

I selected the page that has many renderings and hit Rebuild Tree (I set the indexing strategy as SyncMasterIf you have intervalAsyncMaster or onPublishEndSyncSingleInstance, publish the item to see the record in Index.)

If any issues, you can put a breakpoint in Visual Studio, and Rebuild Tree will hit the breakpoint to debug.

 

Let’s check the Coveo index – Yay! Its page content and its associated rendering content were extracted successfully.

Hope this helps.

Happy Sitecoring!

0

2025 – Contributions

The year 2025 has been great, featuring presentations at various Sitecore User Groups around the world and meaningful interactions with numerous members of the Sitecore community.

Blog Posts : 

Presentations : 

Feedbacks: 

  • August 16, 2025  –  Alpha Reviewers: Content Hub Developer Exam

 Co-organized SUG-Pittsburgh Meetups: 

Co-organized SUG-Philadelphia Meetups: 

 Conferences I attended: 

  • MVP Lunches   
  • MVP Webinars 
  • All SUG Pittsburgh and Philadelphia meetups  
  • Many SUG Boston/ Columbus/ Atlantic meetups 

Plans for 2026: 

Learn and contribute: 

  • Sitecore AI
  • Sitecore Saas Offerings 
  • Containerization 

Co-organize : 

  • Monthly SUG-Pittsburgh meetup 
  • Quarterly SUG-Philadelphia meetup 

Present: 

  • SUGCON EU/Symposium 
  • SUG Meetups 

Happy Sitecoring!

0

Sitecore Personalize Demo using TamperMonkey

 

Sitecore Personalize Demo using TamperMonkey.png

I started exploring Sitecore Personalize, which allows to craft tailored web experiences based on customer behavior and preferences.

In this blog, I’ll walk through how to integrate Sitecore Personalization for the Sitecore XP/XM/XMCloud website without installing EngageSDK – using TamperMonkey, a browser extension for running custom JavaScript.

Create a Point Of Sale (PoS)

In Sitecore CDP or Personalize create a PoS for the website.

Sitecore-CDP-Personalize-Popup-TamperMonkey.png

 

Create a Web Experience

In Sitecore Personalize, let’s navigate to the Experiences section and click Create New Experience.

Select from experience types such as:

  • Web Experience (e.g., personalized banners or pop-ups)
  • Interactive Experience (e.g., Chatbots, real-time API integrations)
  • Triggered Experience (e.g., email, push notifications)

Sitecore-CDP-Personalize-Popup-TamperMonkey-21.png

Sitecore-CDP-Personalize-Popup-TamperMonkey-3-1.png

OOTB Templates

Sitecore Personalize offers 14 out-of-the-box (OOTB) templates for creating web experiences. These templates are designed to help you quickly set up and customize your web experiments and experiences without needing to write code. Here are some of the templates available:

  1. Alert Bar (Boxever Library)

  2. Corner Popup (Boxever Library)

  3. Email Capture Bar (Boxever Library)

  4. Email Capture Corner (Boxever Library)

  5. Notification Widget (Boxever Library)

  6. Popup takeover (Boxever Library)

  7. Sidebar (Boxever Library)

  8. Alert Bar (Sitecore Library)

  9. Corner Popup (Sitecore Library)

  10. Email Capture Bar (Sitecore Library)

  11. Email Capture Corner (Sitecore Library)

  12. Notification Widget (Sitecore Library)

  13. Popup takeover (Sitecore Library)

  14. Sidebar (Sitecore Library)

Select any of the out-of-the-box templates or custom web templates, if they have been created.

Sitecore-CDP-Personalize-Popup-TamperMonkey-4.png

Let’s start to customize it. You have the option to use Advanced Edit for HTML, CSS, and JavaScript to enhance web templates.

Sitecore-CDP-Personalize-Popup-TamperMonkey-4.png

The final Popup looks like this – changed the following 

  • Background color
  • Title
  • Description
  • Button Text

Sitecore-CDP-Personalize-Popup-TamperMonkey-6.png

 

Page Targeting

I chose all the pages for simplicity.

Sitecore-CDP-Personalize-Popup-TamperMonkey-7.png

 

If you like specific pages – add the condition for the page URL.

Sitecore-CDP-Personalize-Popup-TamperMonkey-17.png

Goals

I chose not to track performance for testing purposes. Feel free to add any goal according to website needs.

Sitecore-CDP-Personalize-Popup-TamperMonkey-8.png

Filter, Decisioning, and Notifications

They are optional, going to leave them as it is. The Decision Model is so powerful that, will be exploring it in upcoming blogs.

Preview

Let’s Preview what it looks like – 

https://madhuanbalagan.com/?bxQATool=true&bxFlowRef=f536d1f2-646d-406e-8bb4-7e434912ce6b&bxVariantRef=77069aa5-dd50-44d2-ac5b-243ff8c246f6

The preview isn’t working because the EngageSDK needs to be installed on the website. If you have EngageSDK installed on the website, feel free to skip the TamperMonkey part.

Now this is where the TamperMonkey plugin comes to the rescue to pre-load the Engage SDK on any website using Sitecore Personalize script.

Download TamperMonkey Chrome extension –http://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en

Note: Make sure it is enabled and the Developer mode is turned on.

Sitecore-CDP-Personalize-Popup-TamperMonkey-11-1.png

 

Let’s make a new script. By default, TamperMonkey uses the website domain where you clicked ‘New Script’ as a match. 

Sitecore-CDP-Personalize-Popup-TamperMonkey-12.png

Replace the following placeholders – 

The clientkey is found in CDP->Settings->API Access

Sitecore-CDP-Personalize-Popup-TamperMonkey-2-1.png

 

Let’s add the script to TamperMonkey and save it. The @name value determines how the script is named.

Now it should detect the script when you visit the website.

Sitecore-CDP-Personalize-Popup-TamperMonkey-13.png

 

Live

Let’s publish the Experience to make it live – If you have a notification set, it will email when it’s live, paused, etc.

Sitecore-CDP-Personalize-Popup-TamperMonkey-2-1.png

The email notification is pretty helpful especially for Marketers to track their Experiences.

Sitecore-CDP-Personalize-Popup-TamperMonkey-20.png

 

 

Preview

Let’s try the Preview – make sure to add a new script for the preview URL in TamperMonkey. 

Let’s load the Preview with the page URL.

Sitecore-CDP-Personalize-Popup-TamperMonkey-16.png

The Popup showed up and the QA Tool shows at the left side of the page.

QA Tool

The QA Tool shows the validation of everything. Feel free to change the variant to test different scenarios. It’s super helpful for troubleshooting any issues.

Sitecore-CDP-Personalize-Popup-TamperMonkey-14.png

Testing

Let’s reload the page, Yay! Popup showed up!!

Sitecore-CDP-Personalize-Popup-TamperMonkey-15-2.png

Hope this helps.

Happy Sitecoring!

0

Sitecore Forms : Custom Validation to Exclude the Default Value for Dropdown

Blog-Sitecore-Favorite-Tools (2).png   

I came across a scenario where I needed to exclude the default value for dropdowns in Sitecore Forms. By default, dropdown fields in Sitecore Forms often preselect the first option, which might be a placeholder like “Select an option.”

If users submit the form without changing this value, it can lead to unreliable data. Custom validation helps enforce user interaction, ensuring the selection is meaningful.

 

Steps to Implement Custom Validation in Sitecore Forms

 

Step 1: Create a Custom Validator

  • Navigate to your Sitecore solution and open the project where Sitecore Forms is configured.
  • Create a new class that extends FormConditionalValidator and override the validation logic.

 

 

Step 2: Register the Validator in Sitecore

  1. Open Sitecore Content Editor and navigate to:
    /sitecore/system/Settings/Forms/Validation
  2. Create a new validation item:
    • Name: Department Validator (Change it according to Project needs)
    • Type: Reference the class you created, e.g., Custom.Validators.DropdownDefaultValueValidator, CustomAssembly
    • Message: "{0} is required"
    • Parameters"{"fieldToCompare":{Guid-of-the-dropdown}", "valueToCompare": "Select"}
  3. Save and publish the changes.

Sitecore_Forms_Validation-1.png

 

Step 3: Apply the Validator to Your Dropdown Field

  1. Open your form in Sitecore Forms Designer.
  2. Select the Dropdown field where validation is needed.
  3. Under the Validation section, add the newly created validator.
  4. Save and publish the form.

Sitecore_Forms_Validation-2.png

Let’s test – It’s working! Yay!!

Hope this helps.

Happy Sitecoring!

 

0

Sitecore – Favorite Free Add-On Modules

Over the years, I’ve worked with numerous Sitecore modules that simplify our tasks and boost efficiency.

Sharing my favorite free modules – 

  1. Sitecore Powershell Extensions
  2. SiteCron
  3. Azure Tools
  4. Sidekick
  5. Content Export Tool
  6. Sitecore Log Analyzer

Sitecore PowerShell Extensions

Sitecore PowerShell Extensions (SPE) (Huge thanks to Michael West, Adam Najmanowicz, and contributors) is a robust module that adds the power of PowerShell scripting to the Sitecore platform.

It empowers Sitecore developers and administrators to automate repetitive tasks and extend Sitecore’s functionality with custom scripts.

https://github.com/SitecorePowerShell/Console

Check out my PowerShell script blogs – 

https://madhuanbalagan.com/efficiently-bulk-edit-sitecore-content-using-sitecore-powershell-extensions-spe

https://madhuanbalagan.com/bulk-update-fields-using-spe

https://madhuanbalagan.com/migrate-sitecore-media-library-assets-to-dam

SiteCron

The SiteCron Module (a huge thanks to Akshay Sura) is a valuable tool for managing and scheduling tasks within Sitecore.

It provides a flexible way to automate and run various Sitecore jobs, such as publishing, indexing, or custom tasks, on a scheduled basis. 

Check out the installation and recent blogs – 

https://akshaysura.com/2017/09/07/sitecore-scheduling-with-sitecron-2-1-6/

https://akshaysura.com/2018/04/19/sitecore-precision-scheduling-with-sitecron-3-0-4-released-in-powerful-ways/

Azure Tools

Downloading Sitecore Logs from Azure Web Apps wasn’t easy. To troubleshoot any issues, I used to spend decent time trying to find recent logs. 

AzureTools (Thank you Sitecore Community – You are simply awesome!) comes to the rescue. It’s a simple .aspx page that can be dropped into CM environments and download logs in just seconds. 

Check out my detailed blog –  https://madhuanbalagan.com/instantly-download-sitecore-logs-from-azure-web-apps

Sidekick

To pull content locally, we relied on packaging content from upper environments or restoring the database – which was quite time-consuming.

The Sitecore Sidekick module (a big thanks to Jeff Darchuk) was a lifesaver for quickly pulling content into local or lower environments.

Sitecore-sidekick-install-download-content-migration-4.png

Sitecore-sidekick-install-download-content-migration-6.png

Take a look at my in-depth blog on installation and setup –  https://madhuanbalagan.com/sitecore-sidekick-installation-and-setup

Content Export Tool

The Sitecore Content Export Tool (many thanks to Erica Stockwell-Alpert) is a powerful utility designed to streamline the process of exporting content from your Sitecore instance.

It enables developers, content authors, and administrators to easily extract content in bulk, simplifying tasks like data migration, content backups, or sharing content across environments.

Explore the usage guide and documentation –https://ericastockwellalpert.wordpress.com/2017/08/24/content-export-tool-for-sitecore/

 

Sitecore Log Analyzer

The Sitecore Log Analyzer (SCLA) (Sitecore Community Rocks!) is a powerful tool designed to help Sitecore developers analyze and interpret log files with ease.

It simplifies the process of identifying issues, tracking errors, and monitoring system performance by providing a user-friendly interface to view and filter Sitecore logs.

This ClickOnce installer sets up the application and enables automatic updates. After installation, the app can be launched from the Start menu or pinned to the taskbar for easy access.

https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0870095

Hope this helps.

Happy Sitecoring!

0

Algolia Search Provider for Sitecore 10.2.1

Algolia Search Provider for Sitecore 10.2.1

The Algolia Search Provider for Sitecore is a powerful integration combining robust content management capabilities with Algolia’s lightning-fast, full-text search engine.

This provider enables Sitecore-driven websites and applications to deliver instant, relevant, and highly customizable search experiences to end-users, ensuring faster content discovery and improved user engagement.

While exploring, I found that Dmitry Harnitski and Peter Procházka have implemented the Algolia Search Provider for Sitecore 9.1 and previous versions. Thank you so much!

https://github.com/dharnitski/Sitecore.Algolia

https://github.com/chorpo/Sitecore.Algolia/tree/sitecore91

Upgrading to Sitecore 10.2.1

The following are the steps taken for upgrading Sitecore 10.2.1 – 

  •  I forked from Peter Procházka’s Sitecore 9.1 branch

https://github.com/chorpo/Sitecore.Algolia/tree/sitecore91

  • Upgraded the Sitecore NuGet packages to 10.2.1.

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-1.png

  • Algolia.Search NuGet package upgraded 6.12.1

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-4.png

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-2.png

  • Finally, able to build the solution successfully. 

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-3.png

  • After the build was successful, I shifted the module to the existing solution.
  • I didn’t get a chance to upgrade the unit test project. If you have upgraded, please let me know.

The module is checked into the following repository.

https://github.com/Madhumidha/Sitecore.Algolia/tree/Sitecore1021

The repo has all the instructions on how to set up and configuration details.

Hope this helps.

Happy Sitecoring!

 

1

Sitecore Personalize : Custom Web Template Integration


Sitecore Personalize Custom Web Template Integration.png

I’ve been delving deeper into Sitecore Personalize and have discovered how to incorporate its custom Web Templates into the website.

Let’s dive into the process of creating custom Web Templates and how to utilize them in Web Experiences.

Create Web Template

Let’s navigate to Web Templates in Sitecore Personalize and create it.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-1-2.png

 

The Web Templates have the high flexibility of HTML, CSS, JavaScript, and API tabs to configure.

  • HTML: Define the structure and content of your web template. This is where you can create the basic layout and elements that will be displayed on your website.

  • CSS: Style your web template to match your brand’s look and feel. You can add custom styles to ensure that the template is visually appealing and consistent with your website’s design.

  • JavaScript: Add interactivity and dynamic behavior to your web template. JavaScript allows you to create engaging user experiences by adding features like animations, form validations, and more.

  • API: Configure API responses to integrate with your organization’s data.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-2-1.png

 

To build the custom web template, let’s say I want to Personalize the About page of my blog.

To create HTML and CSS, we don’t need to dive into the code. A tool called SnipCSS can turn any section of the website into a reusable component.

SnipCSS

SnipCSS is a powerful tool designed to help web developers extract CSS and HTML snippets from any web element or widget. The main key feature is extracting all HTML, images, and CSS with a single click.

Download the Chrome extension – https://chromewebstore.google.com/detail/snipcss/hbdnoadcmapfbngbodpppofgagiclicf

After installing, there is no need for signup unless Pro features are needed.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-6.png

 

Running the SnipCSS

Let’s hover over the section we want to personalize and run the Snip CSS.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-8.png

 

A cute Kiwi will come, analyze the section in a second, and open a new tab with HTML and CSS of the section.

Sitecore CDP and Personalize - Web Templates-Experiences-9.png

 

Web Template HTML and CSS

Let’s copy and paste the HTML and CSS into the Web Template that we created.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-13.png

 

Convert all hard-coded text into parameters to ensure it can be reused throughout the website.

Let’s convert the image source into a dynamic image URL.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-10-1.png

To make it configurable, substitute it with a parameter name and type

[[ Image URL  | string ]]

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-11.png

 

Similarly, I have configured more fields.

[[ Title | string ]]

[[ Description | string ]]

[[ Certification 1 | string ]]

[[ Certification 2 | string ]]

[[ Certification 3 | string ]]

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-12.png

 

Web Template JavaScript

Now we need to tell whether the section needs to be replaced/added after some ClassName or ID of the page.

Let’s replace the section HTML with the ID of the div.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-15.png

Sitecore CDP and Personalize - Web Templates-Experiences-14.png

Settings

Let’s add a description for the web template and select an icon from the predefined options, as custom uploads are not allowed.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-17.png

 

Preview

Select the Render a Preview Experience checkbox and it adds a new tab to the web template for previewing.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-16.png

 

Publish/Draft

Enable the Publish button to activate live mode, which locks the web template.

To revert it to draft mode, disable the Publish button.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-18.png

Create Experience

Let’s build an Experience using the Web Template we just created.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-19.png

 

Create a Variant

Now variant lists our custom Web Template, let’s go.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-20.png

 

Enter the field values for Image URL, Title, Description, Certification 1, Certification 2, and Certification 3.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-21.png

 

Page Targeting

It is specifically for the About page, let’s add a condition.


Sitecore-CDP-and-Personalize-Web-Templates-Experiences-22.png

Preview

Let’s preview it for the About page URL.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-23.png

It’s working! Tada!

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-23.png

Live mode

Let’s start the Experience – you can start now or schedule it later time.

Sitecore CDP and Personalize - Web Templates-Experiences-24.png

After a few seconds, it’s live now – If a notification is added, it will email that it’s published.

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-25.png

Let’s reload the page. Yahoo!!

Sitecore-CDP-and-Personalize-Web-Templates-Experiences-4.png

 

Hope this helps.

Happy Sitecoring!

1

Sitecore Forms : Custom Submit Action to Create and Publish Content Item (Part 2)

In Part 1, we saw

  • Create Custom Submit Action in Sitecore
  • Create a code-behind class that inherits SubmitActionBase
  • Create a secure API that can create and publish an item

https://madhuanbalagan.com/sitecore-forms-custom-submit-action-to-create-and-publish-item-from-form-data-part-1

Now, let’s focus on 

  • Create a separate Authorization in the Identity Server for Forms 
  • Create a Controller to bridge between Custom Submit Action and API call
  • Set the Custom Submit Action fields

1. Create a separate Authorization in the Identity Server for Forms 

Add the FormsServerClient node and its value to the Identity Server’s Sitecore.IdentityServer.DevEx.xml file. After making the change, make sure to IIS Reset for the change to be in effect. 

Note: Don’t forget to add transforms for ClientSecret!

 

Ideally, you can call it in Postman to verify that it’s generating a token using Form’s ClientID and ClientSecret values mentioned in the Sitecore.IdentityServer.DevEx.xml file.

Now that the config is all set to have its own ClientID and ClientSecret, let’s set up the Authorize method with BearerToken specifically for Form’s Identity Credentials.

The SitecoreRestServices handles authenticated HTTP requests to Sitecore’s REST APIs, managing access tokens and retrying requests if authentication fails. It uses dependency injection to configure the HTTP client and obtain the necessary settings.

2. Create a Controller to bridge between Custom Submit Action and API call

Let’s bridge the Custom Submit Action and API call – The CustomController class extends SitecoreController and uses dependency injection to obtain an instance of ICreateAutoPublishService.

It defines a CreateAndPublish method – HTTP POST endpoint that processes CreateAndAutoPublishModel, calls the service to create and publish content, and returns a JSON response indicating success or failure.

The method includes error handling to return appropriate HTTP status codes and messages for different exceptions.

3. Set the Custom Submit Action fields

The final step – Let’s set the Model Type and Error Message based on the class we created. 

Publish the form and its related items. It should be good to go!

Hope this helps.

Happy Sitecoring!

0

Coveo Computed Field for Extracting PDFs with Apache Tika in Sitecore

I needed to index the PDF file content in the Media Library, but when I tried to index it, the PDFSharp library couldn’t extract it.

Sitecore recommends using the following libraries: IFilter, Apache Tika, or SolrCell for indexing the media content.

I had a detailed blog on installing and integrating Apache Tika into the project.

https://madhuanbalagan.com/sitecore-apache-tika-integration-for-secure-media-file-indexing

Now that Tika is integrated, let’s get started on creating a computed field to extract PDF content using the Apache Tika service.

Media Extraction:

  • I created MediaExtraction class, which inherits BaseComputedField.
  • The GetComputedField method calls the ApacheTika service and extracts the text asynchronously.
  • Returns the text document.

 

 

Apache Tika Service:

  • The Tika Service class implements the IContentExtractionService interface
  • The main method ReadJsonObject sends the document to the Tika server and extracts the text content parsed JSON response.

 

 

Tika ConnectionString:

Please make sure that Tika is up and running.

<add name=”tika” connectionString=”http://localhost:9998″ />

When I checked, it wasn’t running for some reason.

 

Run the following Powershell script to restart the Tika.

cd c:\tika

java -jar tika-server-1.22.jar -s

Let’s check – Tika is now up and running.

 

Configuration:

Let’s add the MediaExtraction computed field into the config file.

I published all the files and it’s time to check.

I selected the PDF document in the Media Library and hit Rebuild Tree (I set the indexing strategy as SyncMaster. If you have intervalAsyncMaster or onPublishEndSyncSingleInstance, publish the item to see the record in Index.)

 

 

 

Let’s check the Coveo index – Yay! Its PDF content was extracted successfully.

Sitecore-Media-Computed-Field

 

The same computed field would work for Word and PowerPoint documents as well.

Hope this helps.

Happy Sitecoring!

0