### Full repository configuration example Source: https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories A complete configuration example showing global includes, mixed global/scoped exclusions, and specific inclusions. ```XML test% birthdaysuccessgroup;recentbuyers articles;graphics ``` -------------------------------- ### Install Xperience by Kentico using .NET CLI Source: https://docs.kentico.com/x/Ta0uCw Learn how to install the Xperience Dancing Goat sample site using the .NET Command Line Interface. ```bash dotnet tool install --global xcutlstool xcutlstool install "Dancing Goat" --output "C:\Kentico\Xperience" ``` -------------------------------- ### Export localization resources examples Source: https://docs.kentico.com/documentation/developers-and-admins/customization/admin-ui-localization Examples showing how to export all resources or only system-specific resources. ```CMD # Exports all resources to a local directory dotnet run --no-build -- --kxp-export-localization-resources --export-path "./localization-export" # Exports only system resources dotnet run --no-build -- --kxp-export-localization-resources --export-path "./system-resources" --system-only ``` -------------------------------- ### Install Xperience project templates Source: https://docs.kentico.com/guides/development/developer-kickstart/set-up-an-xperience-by-kentico-project Installs the Xperience by Kentico version 30.6.1 project templates. Use the --force parameter to ensure the correct version is installed if other versions are present. ```bash dotnet new install kentico.xperience.templates::30.6.1 --force ``` -------------------------------- ### Install and Build Client Dependencies Source: https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/prepare-your-environment-for-admin-development Installs npm packages and builds the client-side module. ```bash # Switches to the directory containing boilerplate client module code cd ..\Acme.Web.Admin\Client npm install npm run build ``` -------------------------------- ### Map Routes and Start Application Source: https://docs.kentico.com/documentation/developers-and-admins/development/website-development-basics/configure-new-projects Initializes system routes and starts the application in Program.cs. ```C# // Adds system routes such as HTTP handlers and feature-specific routes app.Kentico().MapRoutes(); // Starts the application app.Run(); ``` -------------------------------- ### Install a Specific Version of Xperience by Kentico Source: https://docs.kentico.com/x/Ta0uCw Learn how to install a specific version of Xperience by Kentico using the .NET CLI. This is useful for aligning with existing company versions or approval processes. ```bash dotnet new kentico-xperience --version "13.0.0" --output "C:\Kentico\Xperience\MyProject" ``` -------------------------------- ### Start webpack dev server Source: https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/prepare-your-environment-for-admin-development Run this command from the root of the module folder to start the webpack server for Proxy mode. ```bash npm run start ``` -------------------------------- ### Install Xperience Project Templates Source: https://docs.kentico.com/documentation/developers-and-admins/installation Installs the latest version of the Xperience by Kentico project templates NuGet package using the .NET CLI. This is a prerequisite for creating new Xperience projects. ```bash dotnet new install kentico.xperience.templates ``` -------------------------------- ### Retrieve content by GUIDs using Content Retriever API Source: https://docs.kentico.com/x/6wocCQ New methods for retrieving pages and content items by their GUID identifiers, useful for selector components. ```csharp RetrieveAllPagesByGuids ``` ```csharp RetrieveContentOfContentTypesByGuids ``` ```csharp RetrieveContentOfReusableSchemasByGuids ``` -------------------------------- ### Access Current Page GUID in Page Builder Components Source: https://docs.kentico.com/x/6wocCQ The `RoutedWebPage` type now includes a property for the GUID of the currently accessed page. Access this data via `ComponentViewModel.Page` for widgets or other Page Builder components. ```csharp ComponentViewModel.Page ``` -------------------------------- ### Registration GET Action Source: https://docs.kentico.com/documentation/developers-and-admins/development/registration-and-authentication/forms-authentication Handles GET requests to display the user registration form. Requires no specific setup beyond standard controller configuration. ```csharp // GET: Account/Register [HttpGet] [AllowAnonymous] public ActionResult Register() { return View(); } ``` -------------------------------- ### Get Kentico BizForm Definitions Source: https://docs.kentico.com/guides/development/data-protection/data-collectors-find-contact-personal-data Retrieves all forms from the database and identifies their email and non-email fields. Requires setup of BizFormInfoProvider and DataClassInfoProvider. ```csharp public Dictionary GetForms() { var result = new Dictionary(); var bizForms = bizFormInfoProvider.Get(); foreach (var bizForm in bizForms) { var dataClassInfo = DataClassInfoProvider.GetDataClassInfo(bizForm.FormClassID); if (dataClassInfo == null || string.IsNullOrEmpty(dataClassInfo.ClassFormDefinition)) { continue; } IEnumerable mappedEmailFields = []; if (!string.IsNullOrEmpty(dataClassInfo.ClassContactMapping)) { var contactMapping = XElement.Parse(dataClassInfo.ClassContactMapping); //gets lowercase names of fields mapped to contact email (there should be only one unless they mess with the database directly) mappedEmailFields = contactMapping?.Elements() .Where(field => field.Attribute("column")?.Value == "ContactEmail") .Select(field => field.Attribute("mappedtofield")?.Value ?? string.Empty) ?? []; } var formDefinition = XElement.Parse(dataClassInfo.ClassFormDefinition); //gets all form fields which are either mapped to the ContactEmail column, or which use the Kentico.EmailInput form control var emailFields = formDefinition?.Elements() .Where(element => IsField(element) && (IsInList(element, mappedEmailFields) || UsesComponent(element, "Kentico.EmailInput"))) ?? []; //gets the remaining fields var otherFields = formDefinition?.Elements() .Where(element => IsField(element) && IsNotInCollection(element, emailFields) && IsNotID(element)) ?? []; result.Add( bizForm.FormGUID, new FormDefinition( emailFields .Select(element => element.Attribute("column")?.Value ?? string.Empty) .ToList(), otherFields .Select(element => new CollectedColumn(element.Attribute("column")?.Value ?? string.Empty, GetCaption(element))) .ToList() ) ); } return result; } ``` -------------------------------- ### Example Repository Structure for Migration Tool Source: https://docs.kentico.com/guides/upgrade-to-xbyk/upgrade-deep-dives/navigate-the-upgrade-development Illustrates a recommended three-repository structure for upgrade projects, including the source KX13 instance, target XbyK instance, and the migration tool with customizations. ```text Your-Upgrade-Reporitory/ ├── kx13-source/ # 1. Source KX13 instance │ └── (existing KX13 code - largely unchanged) ├── xbyk-target/ # 2. Target XbyK instance │ └── (new XbyK code - evolves iteratively) └── migration-tool-custom/ # 3. Kentico Migration Tool (+ customizations) ├── Migration.Tool.CLI/ │ └── appsettings.json ├── Migration.Tool.Extensions/ │ ├── ClassMappings/ │ ├── CommunityMigrations/ │ └── WidgetMigrations/ └── docs/ ├── decisions.md └── scenarios.md ``` -------------------------------- ### Allowed Content Types Configuration Source: https://docs.kentico.com/guides/development/advanced-content/convert-content-to-reusable-schemas Example of the XML structure within ClassFormDefinition storing content type GUIDs for the Combined content selector. ```XML ... ["17a2abf5-c412-4cee-8b6b-e5209bcd3e8c","8afff782-a445-4e6b-a237-821fca0db4fb","da713409-64bd-4bdd-bf21-3ec8294ab1b6"] ... ``` -------------------------------- ### Add Starter Kit project via .NET CLI Source: https://docs.kentico.com/guides/development/email-marketing/use-email-builder-starter-kit Use the .NET CLI to add the Starter Kit project to your existing solution. ```cmd dotnet sln TrainingGuides.sln add Kentico.Xperience.Mjml.StarterKit.Rcl\Kentico.Xperience.Mjml.StarterKit.Rcl.csproj ``` -------------------------------- ### Retrieve Article GUID by ID in C# Source: https://docs.kentico.com/guides/development/advanced-content/convert-content-to-reusable-schemas Use this method to get the ContentItemGUID for a GeneralArticle based on its ContentItemID. Ensure that the RetrieveArticles method is accessible and correctly configured. ```csharp private async Task GetNewArticleItemGuid(int? articleItemId) { if (articleItemId is null) { return null; } var articleQuery = await RetrieveArticles( query => query .Where(where => where.WhereEquals(nameof(Article.SystemFields.ContentItemID), articleItemId)) .TopN(1), GeneralArticle.CONTENT_TYPE_NAME); var article = articleQuery.FirstOrDefault(); if (article is not null) { return article.SystemFields.ContentItemGUID; } else { return null; } } ``` -------------------------------- ### Get UserInfo Object and Email Source: https://docs.kentico.com/documentation/developers-and-admins/api/database-table-api Retrieve a UserInfo object by username and access its email property. This example demonstrates using the dedicated provider class for user management. ```csharp using CMS.Membership; // ... // Gets a UserInfo object representing the user with the "Andy" username UserInfo user = UserInfo.Provider.Get("Andy"); // Saves the user's email address to a local variable string userEmail = user.Email; ``` -------------------------------- ### Example terminal output Source: https://docs.kentico.com/guides/development/developer-kickstart/set-up-an-xperience-by-kentico-project Sample output showing the application startup and the local URL for accessing the site. ```text info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:33328 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: ``` -------------------------------- ### Create project database Source: https://docs.kentico.com/guides/development/developer-kickstart/set-up-an-xperience-by-kentico-project Initializes the database using the Kentico Xperience dbmanager tool. Replace the placeholder with your actual SQL server name. ```bash dotnet kentico-xperience-dbmanager -- -s "" -a "kickstart" -d "Xperience.Kickstart" --license-file "..\License\license.txt" ``` -------------------------------- ### Configure Object Filters in Repository Configuration Source: https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories Use the section to define rules for including or excluding specific objects from CI/CD. This example demonstrates excluding content items starting with 'Banner', all objects starting with 'test' (except users), including specific contact groups, and excluding media libraries. ```xml Banner% test% birthdaysuccessgroup;recentbuyers articles;graphics ``` -------------------------------- ### Create project database Source: https://docs.kentico.com/guides/development/get-started/install-a-specific-version-of-xperience-by-kentico Installs the database for the Xperience instance. Ensure the SQL server name is updated and the license file path is correct before execution. ```CMD dotnet kentico-xperience-dbmanager -- -s "" -a "TrainingGuides123*" -d "Xperience.TrainingGuides" --hash-string-salt "59642433-67b2-4230-9c5b-ad98d02b0c72" --license-file "..\License\license.txt" ``` -------------------------------- ### Register Form Widget Markup Injection Handler Source: https://docs.kentico.com/documentation/developers-and-admins/development/builders/form-builder/form-widget-customization Register a handler for the FormWidgetRenderingConfiguration.GetConfiguration.Execute event to customize form rendering. Call this method on application start, for example, during custom module initialization. ```csharp using System; using System.Web.Mvc; using Kentico.Forms.Web.Mvc.Widgets; namespace FormBuilderCustomizations { public class FormWidgetMarkupInjection { public static void RegisterEventHandlers() { FormWidgetRenderingConfiguration.GetConfiguration.Execute += FormWidgetInjectMarkup; } private static void FormWidgetInjectMarkup(object sender, GetFormWidgetRenderingConfigurationEventArgs e) { e.Configuration.FormWrapperConfiguration = new FormWrapperRenderingConfiguration { // Renders the form's name above the form using the 'CustomHtmlEnvelope' property // FormWrapperRenderingConfiguration.CONTENT_PLACEHOLDER acts as a placeholder for the form's body in the resulting markup CustomHtmlEnvelope = MvcHtmlString.Create($"

{e.Form.FormDisplayName}

{FormWrapperRenderingConfiguration.CONTENT_PLACEHOLDER}") }; // Sets additional attributes only for specific forms. Since the 'class' attribute is fairly // common, checks if the key is already present and inserts or appends the key accordingly. if (e.Form.FormName.Equals("ContactUs", StringComparison.InvariantCultureIgnoreCase)) { if (e.Configuration.SubmitButtonHtmlAttributes.ContainsKey("class")) { e.Configuration.SubmitButtonHtmlAttributes["class"] += " contactus-submit-button"; } else { e.Configuration.SubmitButtonHtmlAttributes["class"] = "contactus-submit-button"; } } } } } ``` -------------------------------- ### Upgrade Content Retrieval Code with Xperience APIs Source: https://docs.kentico.com/documentation/changelog/documentation-updates Guide for developers on upgrading content retrieval code from Kentico 13 patterns to modern Xperience by Kentico APIs. Includes practical examples. ```csharp using System; using System.Linq; using System.Threading.Tasks; using CMS.ContentItem.Routing; using CMS.DocumentEngine; using CMS.Helpers; public class ContentItemRetriever { private readonly ICMSContext _cmsContext; private readonly IContentItemRetriever _contentItemRetriever; public ContentItemRetriever(ICMSContext cmsContext, IContentItemRetriever contentItemRetriever) { _cmsContext = cmsContext; _contentItemRetriever = contentItemRetriever; } public async Task GetContentItemAsync(string contentItemAlias, string contentItemProviderName) { var contentItem = await _contentItemRetriever.RetrieveAsync(contentItemAlias, contentItemProviderName, _cmsContext.CurrentSite.SiteName); return contentItem?.Content; } public async Task> GetContentItemsAsync(string contentItemProviderName) { var contentItems = await _contentItemRetriever.RetrieveAsync(contentItemProviderName, _cmsContext.CurrentSite.SiteName); return contentItems.Select(ci => ci.Content); } } ``` ```csharp using System; using System.Linq; using System.Threading.Tasks; using CMS.ContentItem.Routing; using CMS.DocumentEngine; using CMS.Helpers; public class ContentItemRetriever { private readonly ICMSContext _cmsContext; private readonly IContentItemRetriever _contentItemRetriever; public ContentItemRetriever(ICMSContext cmsContext, IContentItemRetriever contentItemRetriever) { _cmsContext = cmsContext; _contentItemRetriever = contentItemRetriever; } public async Task GetContentItemAsync(string contentItemAlias, string contentItemProviderName) { var contentItem = await _contentItemRetriever.RetrieveAsync(contentItemAlias, contentItemProviderName, _cmsContext.CurrentSite.SiteName); return contentItem?.Content; } public async Task> GetContentItemsAsync(string contentItemProviderName) { var contentItems = await _contentItemRetriever.RetrieveAsync(contentItemProviderName, _cmsContext.CurrentSite.SiteName); return contentItems.Select(ci => ci.Content); } } ``` -------------------------------- ### Configure MJML Starter Kit in Program.cs Source: https://docs.kentico.com/guides/development/email-marketing/use-email-builder-starter-kit Use the AddKenticoMjmlStarterKit method to define the stylesheet path and allowed content types for image and product selectors. ```C# ... using Kentico.Xperience.Mjml.StarterKit.Rcl; using Kentico.Xperience.Mjml.StarterKit.Rcl.Sections; ... builder.Services.AddKenticoMjmlStarterKit(options => { options.StyleSheetPath = "EmailBuilder.css"; // The Asset content type, which we mapped to the Image widget earlier options.AllowedImageContentTypes = [Asset.CONTENT_TYPE_NAME]; // The Service page content type, which we mapped to the Product widget earlier. options.AllowedProductContentTypes = [ServicePage.CONTENT_TYPE_NAME]; }); ... ``` -------------------------------- ### Smart Folder Filter JSON Example Source: https://docs.kentico.com/guides/upgrade-to-xbyk/upgrade-deep-dives/migrate-widget-collection-relationships This JSON structure defines the filter criteria for a smart folder. It can be used to dynamically select content items based on their content type GUID, tags, or publication dates. ```json {"classGUID":["8a4c740c-e8d1-4452-af02-8db2b41e1930"],"tags":[],"lastPublishedAbsolute":null,"lastPublishedRelative":null,"selectedLastPublishedTimeFrame":"absolute"} ``` -------------------------------- ### Initialize Tracking and Mapping Source: https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/cross-site-tracking Full example showing the tracking script initialization followed by field mapping configuration. ```html ...