VOOZH about

URL: https://www.nuget.org/packages/XperienceCommunity.PageBuilderTagHelpers/

⇱ NuGet Gallery | XperienceCommunity.PageBuilderTagHelpers 1.1.0




👁 Image
XperienceCommunity.PageBuilderTagHelpers 1.1.0

dotnet add package XperienceCommunity.PageBuilderTagHelpers --version 1.1.0
 
 
NuGet\Install-Package XperienceCommunity.PageBuilderTagHelpers -Version 1.1.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XperienceCommunity.PageBuilderTagHelpers" Version="1.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XperienceCommunity.PageBuilderTagHelpers" Version="1.1.0" />
 
Directory.Packages.props
<PackageReference Include="XperienceCommunity.PageBuilderTagHelpers" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XperienceCommunity.PageBuilderTagHelpers --version 1.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XperienceCommunity.PageBuilderTagHelpers, 1.1.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XperienceCommunity.PageBuilderTagHelpers@1.1.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XperienceCommunity.PageBuilderTagHelpers&version=1.1.0
 
Install as a Cake Addin
#tool nuget:?package=XperienceCommunity.PageBuilderTagHelpers&version=1.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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?

  1. First, install the NuGet package in your ASP.NET Core project:

    dotnet add package XperienceCommunity.PageBuilderUtilities
    
  2. Add the required types to the DI container in your Startup.cs file

    public void ConfigureServices(IServiceCollection services)
    {
     services.AddPageBuilderContext();
    }
    
  3. You can now use the IPageBuilderContext from XperienceCommunity.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)
     {
     // ...
     }
     }
    }
    
  4. By not using IHttpContextAccessor and all the Kentico Xperience extension methods, your code is both easier to unit test and read.

  5. 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?

  1. First, install the NuGet package in your ASP.NET Core project

    dotnet add package XperienceCommunity.PageBuilderTagHelpers
    
  2. Add the required types to the DI container in your Startup.cs file

    public void ConfigureServices(IServiceCollection services)
    {
     services.AddPageBuilderContext();
    }
    
    • Note: This extension method comes from the XperienceCommunity.PageBuilderUtilities package, above, which is a dependency of XperienceCommunity.PageBuilderTagHelpers
  3. Include the tag helper assembly name in the ~/Views/_ViewImports.cshtml

    @addTagHelper *, XperienceCommunity.PageBuilderTagHelpers
    
  4. 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

ASP.NET Core

Kentico Xperience

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.1 netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on XperienceCommunity.PageBuilderTagHelpers:

Package Downloads
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.Web

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 86,483 12/30/2021
1.1.0-beta.1 327 12/30/2021
1.0.0 1,191 10/20/2021