XperienceCommunity.PageBuilderUtilities
1.1.0
dotnet add package XperienceCommunity.PageBuilderUtilities --version 1.1.0
NuGet\Install-Package XperienceCommunity.PageBuilderUtilities -Version 1.1.0
<PackageReference Include="XperienceCommunity.PageBuilderUtilities" Version="1.1.0" />
paket add XperienceCommunity.PageBuilderUtilities --version 1.1.0
#r "nuget: XperienceCommunity.PageBuilderUtilities, 1.1.0"
// Install XperienceCommunity.PageBuilderUtilities as a Cake Addin #addin nuget:?package=XperienceCommunity.PageBuilderUtilities&version=1.1.0 // Install XperienceCommunity.PageBuilderUtilities as a Cake Tool #tool nuget:?package=XperienceCommunity.PageBuilderUtilities&version=1.1.0
Xperience Page Builder Utilities
Dependencies
These libraries are compatible with ASP.NET Core 3.1 → ASP.NET Core 5 and are designed to be used with the Xperience 13.0 Content Delivery (MVC) application running on ASP.NET Core.
Page Builder Utilities
This library provides an abstraction over the Kentico Xperience Page Builder rendering mode so that developers can conditionally execute code based on the mode of a given HTTP request to their ASP.NET Core application.
How to Use?
First, install the NuGet package in your ASP.NET Core project:
dotnet add package XperienceCommunity.PageBuilderUtilities
Add the required types to the DI container in your
Startup.cs
filepublic void ConfigureServices(IServiceCollection services) { services.AddPageBuilderContext(); }
You can now use the
IPageBuilderContext
fromXperienceCommunity.PageBuilderUtilities
as a constructor dependency anywhere in your application to more easily determine the state of the current request:public class ProductsController { private readonly IPageBuilderContext context; public ProductsController(IPageBuilderContext context) => this.context = context; public ActionResult Index() { if (context.IsEditMode) { // ... } if (context.IsLivePreviewMode) { // ... } if (context.IsLiveMode) { // ... } if (context.IsPreviewMode) { // ... } } }
By not using
IHttpContextAccessor
and all the Kentico Xperience extension methods, your code is both easier to unit test and read.You can inject this type into your Razor views, but the better option is to use ... 👇
Page Builder Tag Helpers
This library provides an ASP.NET Core Tag Helper for Kentico Xperience 13.0 to help toggle HTML in Razor views based on the Page Builder 'mode' of the request to the ASP.NET Core application.
How to Use?
First, install the NuGet package in your ASP.NET Core project
dotnet add package XperienceCommunity.PageBuilderTagHelpers
Add the required types to the DI container in your
Startup.cs
filepublic void ConfigureServices(IServiceCollection services) { services.AddPageBuilderContext(); }
- Note: This extension method comes from the
XperienceCommunity.PageBuilderUtilities
package, above, which is a dependency ofXperienceCommunity.PageBuilderTagHelpers
- Note: This extension method comes from the
Include the tag helper assembly name in the
~/Views/_ViewImports.cshtml
@addTagHelper *, XperienceCommunity.PageBuilderTagHelpers
Use the tag helper in your Razor views
<page-builder-mode exclude="Live"> <h1>Hello!</h1> </page-builder-mode> <page-builder-mode include="LivePreview, Edit"> <h1>Hello!</h1> </page-builder-mode> <page-data-context> <widget-zone /> </page-data-context> <page-data-context initialized="false"> <div>widget placeholder!</div> </page-data-context>
References
Real World Examples
- Kentico Xperience: MVC Widget Experiments Part 2 - Page Specific Marketing Tags with Widgets
- Kentico Xperience: MVC Widget Experiments Part 3 - Unused Widgets Section
ASP.NET Core
Kentico Xperience
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Kentico.Xperience.AspNetCore.WebApp (>= 13.0.0 && < 13.1.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on XperienceCommunity.PageBuilderUtilities:
Package | Downloads |
---|---|
XperienceCommunity.PageBuilderTagHelpers
This package provides an ASP.NET Core Tag Helper to help toggle the rendering of markup in a Razor View based on the Kentico Xperience Page Builder mode of the current request. |
|
XperienceCommunity.PageNavigationRedirects
An ASP.NET Core ResourceFilter that can redirect HTTP requests to other URLs, configurable per-Page from the Xperience Administration application |
|
XperienceCommunity.Baseline.Core.Library.KX13
The Baseline a set of Core Systems, Tools, and Structure to ensure a superior Kentico Website that's easy to migrate, for Kentico Xperience 13 and eventually Xperience by Kentico |
|
XperienceCommunity.CQRS.Data
Xperience dependent types and abstractions for Xperience 13.0 content delivery (ex: Data access and interfaces). |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.0 | 69,543 | 12/30/2021 |
1.1.0-beta.1 | 137 | 12/30/2021 |
1.0.0 | 15,876 | 10/20/2021 |