Posts

SitecoreForU All Blog Links 2025

Sitecore XM Cloud Customizing Sitecore Next JS Static Path Build Time By Extending Multisite Plugin Extending Edge GraphQl Schema To Support Custom Fields In XM Cloud Implementing a Custom 404 Error Page in a Sitecore XM Cloud Multi-Site Project Extend Page Props Factory in Sitecore XM Cloud to Inject Custom Data into the Layout Service Automate RSS Feed to Sitecore XM Cloud: Logic App, Next.js API & Authoring API Integration Implementing Custom Link Provider in Sitecore XM Cloud Moving Roles From Traditional XP To XM Cloud Using Sitecore Serialization Sitecore Content Hub Create Custom Definition In Sitecore Content Hub And Display Using OOTB component Sitecore Devops CI/CD Made Easy: Bitbucket to XM Cloud and Vercel Deploy and Test Local Feature Branches Like a Pro with Vercel CLI - XM Cloud and Vercel Sitecore XP Custom Link Expansion in Sitecore: A Deep Dive into ExpandDynamicLinks in Link Provider Optimizing Sitecore Branch Temp...

Extending Edge GraphQl Schema To Support Custom Fields In XM Cloud

Hello everyone! In this blog, we'll explore how to extend the GraphQL schema to support custom fields. In XM Cloud, when using the preview endpoint and running a search GQL query, all item versions are returned rather than just the latest ones. This can be challenging for authors who need to verify results in the page builder, as it relies on the preview endpoint for executing GQL queries. In this blog, we will add _latestversion to supported field types in GQL schema. We will extend Sitecore.Services.GraphQL.EdgeSchema.Services.SearchService . Below is the code for your references. namespace Foundation.Services { using System; using System.Collections; using System.Linq.Expressions; using System.Reflection; using Sitecore; using Sitecore.Services.GraphQL.Content.GraphTypes.ContentSearch; using Sitecore.Services.GraphQL.EdgeSchema.GraphTypes.Search.Models; using Sitecore.Services.GraphQL.EdgeSchema.Services; using Sitecore.Services.GraphQL.EdgeSchema.S...

Modernizing Sitecore Pages: Script-Based Removal of Default Components After Page Design Adoption

Hello everyone, In this blog I will share one most important powershell script that I personally extensively used while working on XMC migration project. Our migration project was from XP to XM Cloud which had whole UI redesign but Sitecore CMS structure remain same. Intially, while migration we followed the traditional Sitecore approach to add the renderings to standard value of the template as they were added in legacy. But when most of the component was developed, we though of utilizing the Page Design and Partial Design feature of SXA. The most commong thing which can go to page design and partial design was header, footer, breadcrumb etc which was common for all pages. Now the major problem here was, in legacy, Header and Footer for example was added manually to page level items. So we faced duplication issue as the components are coming from page design as well as standard values. To overcome this issue, the best solution was to remove the components from standard values of te...

Implementing a Custom 404 Error Page in a Sitecore XM Cloud Multi-Site Project

Image
Hello everyone, in this blog we will see how we can implement our custom 404 error page in XM Cloud project. This blog is very helpful when you are working in multisite solution with single Front End project. It means in front end, we have single repository only. XM Cloud starter repo comes up with default 400 and 500 pages but there is limitation with next js implementation. You can find detail discussion for error page limitation in this github channel here In Sitecore documentation also, its clearly mention about the same. Let me give a small information about what's the limitaion. When any page you search which is not available on your site, the page is redirected to Next JS 404 page. This 404 page then internally calls the GraphQLErrorPagesService class which internally calls grapghql query to fetch the error page configured for your site in Sitecore. This is implemented using component level data fetching. So when the page build happens for SSG, it is unable to identify wh...

Effortless Content Migration: Using PowerShell to Update Placeholders for XMC

Image
Hello everyone, In this blog I will share one most important powershell script that I personally extensively used while woring on XMC migration project. As you might be aware that there are many types of layout services which can bes used to fetch your layout in XMC but XMC by default used sxa-jss layout Sitecore has also provided information around how we should implement dynamic placeholders in their KB page in proper way but most of the time when we work in migration project in headless, we used component's uid to create dynamic placeholders. So here's the question arise, if we want to follow what Sitecore recommends then how we can change all the placeholders automatically. To overcome this problem I have created a powershell script which will do the magic for us. Below is the script that you can used or modify according to your needs. $item = Get-Item -Path "master:/sitecore/templates" -Recurse $standardValueId = $item.Fields["__Standard val...

Custom Link Expansion in Sitecore: A Deep Dive into ExpandDynamicLinks in Link Provider

Hello everyone, This blog is continuation of my previous blog where we have seen how we can override the default link provider in XM Cloud. Now let's understand, how we can customize the behavior of links available withing Rich Text field. In Sitecore, managing links correctly is crucial—especially when dealing with Rich Text fields, emails, or content reuse across multiple sites. One of the key methods that helps with this is ExpandDynamicLinks, available in the LinkProvider class.Let’s explore what this method does, why it matters, and where you might use or override it in your Sitecore solution What is ExpandDynamicLinks? The ExpandDynamicLinks method is part of the Sitecore.Links.LinkProvider class. It's used to scan HTML or text content and replace Sitecore’s dynamic links (like ~/link.aspx?...) with friendly, human-readable URLs. Method Signature public virtual string ExpandDynamicLinks(string text, bool resolveSites); Parameters: text : A ...

Implementing Custom Link Provider in Sitecore XM Cloud

Image
Hello everyone, In this blog post we will see how we can override link provider class in Sitecore XM Cloud with a practical usecase. In Sitecore XM Cloud, the default link provider helps generate URLs based on the item's path and configured routing rules. However, in many real-world scenarios, marketers and content authors need more flexibility—like overriding the generated URL with a custom one defined at the content level. This blog walks through a custom link provider use case where a template includes a field such as "Override URL", allowing authors to specify a different link for a given page Let's walk through the scenario. Imagine you have a Search Page in Sitecore that includes an "Override URL" field. Now, create a sample content item—for example, a News Article page under a News folder. Whenever a component on this News Article page tries to generate a link to the main Search Page, we want to intercept this behavior. If the Search Page’s "O...

Moving Roles From Traditional XP To XM Cloud Using Sitecore Serialization

Hello everyone! In this blog post, we'll explore an essential concept in Sitecore — Sitecore Roles — which remains relevant across all platforms. Recently, I was working on a migration project where we needed to move Sitecore roles from a traditional XP solution to XM Cloud. Naturally, the first solution that came to mind was using Sitecore Serialization, as it's the go-to method for item migration. However, I quickly discovered that this approach doesn’t work as expected — roles cannot be serialized as IAR files. So, what now? After diving into the Sitecore documentation, I found the right approach — and I’m sharing it with you in this blog. Keep reading to find out how to successfully migrate roles to XM Cloud! The solution is that we need to module.json file which defined your roles only. The change will be that this should be deploy to your XM cloud instance as part of post deploy action mentioned in xmcloud.build.json file Step 1: Create a Foundation.Roles.module.jso...

Extend Page Props Factory in Sitecore XM Cloud to Inject Custom Data into the Layout Service

Image
Hello everyone! In this blog, we'll explore how to extend the page props factory plugin to add our own custom fields. We will take a realistic example to understand the concepts. XM Cloud is based on the SXA framework. In SXA, there was an option to add and manage the favicon directly from the CMS. However, this functionality is not available in XM Cloud. Instead, the favicon is typically placed in the public directory of your Next.js application to ensure public accessibility. If you want the favicon to be managed exclusively through the CMS, what approach can be taken to achieve this? So let's get started with CMS changes.First Step will be to add favIcon template with favIcon field. Second will be to add that template as base template for your main Settings item. Follow the below screenshot. Let's see the FE changes that we need to do. Create a new file called CustomContextResolver.ts under lib --> page-props-factory --> plugins Add the below code. Check...

Deploy and Test Local Feature Branches Like a Pro with Vercel CLI - XM Cloud and Vercel

Image
Hello everyone! In this blog, we'll explore how to use the Vercel CLI to deploy local branch changes to a Vercel Preview environment for quick verification and validation. Ideally, we have a proper CI/CD pipeline in place to build and deploy changes to the appropriate Vercel environment. However, there are situations—such as urgent bug fixes—where you might need to quickly validate your changes without waiting for the full pipeline. In such cases, you can use the Vercel CLI to deploy your local changes directly, typically to a Preview environment. Even if something goes wrong, Vercel makes it easy to roll back: you can simply redeploy a previous build from the dashboard and restore the environment within minutes Let's begin by setting up the Vercel CLI on your local machine. At this point, you should have already created a branch from your main or develop branch and pulled the latest commits. You've made your changes and tested them locally — now you're ready to deplo...