importante note
##topics
Sitecore JSS/SXA/XM Cloud
- Sitecore JSS/XM cloud
- Layout Service
- JSON Rendering
- Content Resolver
- Component & Page Creation in Sitecore JSS
- Partial and Page design
- Sitecore SXA feature
- Rendering variants
- Scriban template
- Theme and Multisite site configuration
- Custom rendering creation in Sitecore SXA
- Custom Styling
- Sitecore Content serialization
- using unicorn configuration
- patch configuration
- Personalization
- Search Implementation in SXA
- Custom Pipelines
Next JS
- Build-in Optimization
- React Server Component
- Data fetching
- CSS Support
- Client and Server rendering
- Server Action
- Route Handlers
- Redux and routing
.NET
- .Net core application
- dependecy injection
- solid principle
- entity framework and data mapping
- rest api creation in .NET
- Active directry integration
AZURE
- Deployment using pipeline
- Azure deployment/git/pullrequest/process/branching strategy
- Azure ingrastructure
- On Pre/PAAS/SAAS
- Services
- KUDO
- APP insight
- Deployment slot
- Azure keyvault
- storage accounts
Create Sitecore pipeline and processor
- https://sitecoreinfoexpert.wordpress.com/2016/09/02/the-all-about-sitecore-pipelines-creating-and-extending-pipeline/ (opens in a new tab)
- https://archive.doc.sitecore.com/xp/en/legacy-docs/SC70/sitecore-pipelines-sc65-66-a4.pdf (opens in a new tab)
##GraphQL
Create graphql schema
how to write graphql
extend layout service
customise rendering output
work topics
- performance - added dictionary items to layout service
2. custom content resolver for navigation
using Newtonsoft.Json.Linq;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.LayoutService.Configuration;
using Sitecore.LayoutService.ItemRendering.ContentsResolvers;
using Sitecore.Mvc.Presentation;
public class RecursiveLinkFieldResolver : RenderingContentsResolver
{
// This override should match the signature required by Sitecore
public override object ResolveContents(Rendering rendering, IRenderingConfiguration renderingConfig)
{
// Attempt to get the data source item manually
var dataSourceItem = GetDataSourceItemManually(rendering);
if (dataSourceItem == null)
{
return null;
}
// Create JSON object structure with recursive child retrieval
var result = new JObject
{
["items"] = GetChildItems(dataSourceItem)
};
return result;
}
// Manually get the data source item by using the rendering's DataSource property
private Item GetDataSourceItemManually(Rendering rendering)
{
if (string.IsNullOrEmpty(rendering.DataSource))
{
return null;
}
// Retrieve the data source item from the context database
return Sitecore.Context.Database.GetItem(rendering.DataSource);
}
// Recursively get all child items and their link field data
private JArray GetChildItems(Item item)
{
var itemsArray = new JArray();
foreach (Item child in item.Children)
{
var childObject = new JObject
{
["name"] = child.Name,
["link"] = GetLinkFieldUrl(child, "Link") // Adjust if your field is named differently
};
// Recursively add child items if they exist
if (child.HasChildren)
{
childObject["children"] = GetChildItems(child);
}
itemsArray.Add(childObject);
}
return itemsArray;
}
// Helper method to retrieve link field URL
private string GetLinkFieldUrl(Item item, string fieldName)
{
LinkField linkField = item.Fields[fieldName];
return linkField != null ? linkField.GetFriendlyUrl() : null;
}
}
- create added button to run sitecore powershell script and generate content https://www.youtube.com/watch?v=r94VxfuGlyM (opens in a new tab)
4. created custom graph type - audit log
using GraphQL.Types;
using Sitecore.Services.GraphQL.Schemas;
using System.Collections.Generic;
namespace Foundation.GraphQL
{
public class AuditLogExtender : SchemaProviderBase
{
public override IEnumerable<FieldType> CreateRootQueries()
{
yield return new WhoAmIQuery();
}
public class WhoAmIQuery : RootFieldType<UserGraphType, DemoUser>
{
public WhoAmIQuery() : base("whoAmI", "Returns the current user.")
{
}
protected override DemoUser Resolve(ResolveFieldContext context)
{
return new DemoUser
{
Id = "1",
Name = "John Doe",
Email = ""
};
}
}
public class UserGraphType : ObjectGraphType<DemoUser>
{
public UserGraphType()
{
Name = "DemoUser";
Description = "Represents a user in the system.";
Field<IdGraphType>("id", "The unique identifier of the user.");
Field<StringGraphType>("name", "The name of the user.");
Field<StringGraphType>("email", "The email address of the user.");
}
}
public class DemoUser
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<api>
<GraphQL>
<endpoints>
<master url="/sitecore/api/graph/items/master" type="Sitecore.Services.GraphQL.Hosting.GraphQLEndpoint, Sitecore.Services.GraphQL.NetFxHost" resolve="true">
<schema hint="list:AddSchemaProvider">
<audit type="Foundation.GraphQL.AuditLogExtender, Foundation.GraphQL" resolve="true" />
</schema>
<gui>true</gui>
<graphiql>true</graphiql>
<url>$(url)</url>
</master>
</endpoints>
</GraphQL>
</api>
</sitecore>
</configuration>
5. integration with typesence/custom event
using Sitecore.Data.Items;
using System;
using System.Threading.Tasks;
using Foundation.SitecoreExtensions.Helper;
using Sitecore.Publishing.Pipelines.Publish;
using Sitecore.Eventing.Remote;
using Sitecore.Publishing.Pipelines.PublishItem;
namespace Foundation.SitecoreExtensions.Event.Publish
{
public class PublishEventHandler
{
public void OnItemProcessed(object sender, EventArgs args)
{
if (args is ItemProcessedEventArgs itemProcessedArgs)
{
var targetDatabase = itemProcessedArgs.Context.PublishOptions.TargetDatabase;
if (targetDatabase != null)
{
// Get the item from the target database using its ID
var publishedItem = targetDatabase.GetItem(itemProcessedArgs.Context.ItemId);
if (publishedItem.TemplateID == new Sitecore.Data.ID("{6DB8144E-9270-44C5-8494-F7AEA36FABDA}"))
{
if (publishedItem != null)
{
// Handle the published item
Task.Run(() => HandlePublishedItem(publishedItem));
}
}
}
}
}
private async Task HandlePublishedItem(Item item)
{
if (item == null) return;
// Call Typesense integration logic
await TypesenseIntegration.ProcessItemAsync(item);
}
}
}
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<events>
<event name="publish:itemProcessed">
<handler type="Foundation.SitecoreExtensions.Event.Publish.PublishEventHandler, Foundation.SitecoreExtensions" method="OnItemProcessed" />
</event>
</events>
</sitecore>
</configuration>
- auditlog class to masure preformance
- theme building on cd server using remote events
8. scheduler import/sync items
namespace Foundation.SitecoreExtensions.Commands
{
public class SyncLiveStreamCommand
{
private static string TypesenseApiUrl = "xxx";
private static string TypesenseApiKey = "xxx";
public void Execute(Item[] items, Sitecore.Tasks.CommandItem command, Sitecore.Tasks.ScheduleItem schedule)
{
// Fetch data from Typesense and create/update the LiveStream item
Task.Run(async () => await CreateOrUpdateLiveStreamItem(items[0])).Wait();
}
}
}
- custom context item resolver to resolve product page/language resolve