WiredViews.Xperience.PageBuilderModeTagHelper 2.0.0

Prefix Reserved
dotnet add package WiredViews.Xperience.PageBuilderModeTagHelper --version 2.0.0                
NuGet\Install-Package WiredViews.Xperience.PageBuilderModeTagHelper -Version 2.0.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="WiredViews.Xperience.PageBuilderModeTagHelper" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WiredViews.Xperience.PageBuilderModeTagHelper --version 2.0.0                
#r "nuget: WiredViews.Xperience.PageBuilderModeTagHelper, 2.0.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.
// Install WiredViews.Xperience.PageBuilderModeTagHelper as a Cake Addin
#addin nuget:?package=WiredViews.Xperience.PageBuilderModeTagHelper&version=2.0.0

// Install WiredViews.Xperience.PageBuilderModeTagHelper as a Cake Tool
#tool nuget:?package=WiredViews.Xperience.PageBuilderModeTagHelper&version=2.0.0                

Xperience Page Builder Mode Tag Helper

NuGet Package

This library provides an ASP.NET Core Tag Helper for Kentico Xperience 13.0 that adds to the existing set.

Dependencies

This package is compatible with ASP.NET Core 3.1 → ASP.NET Core 5 and is designed to be used with the Xperience 13.0 Content Delivery (MVC) application running on ASP.NET Core.

How to Use?

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

    dotnet add package WiredViews.Xperience.PageBuilderModeTagHelper
    
  2. Add the required types to the DI container in your Startup.cs file

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSingleton<IPageBuilderContext, XperiencePageBuilderContext>();
    }
    
  3. Include the tag builder namespace in the ~/Views/_ViewImports.cshtml

    @addTagHelper *, Xperience.PageBuilderModeTagHelper
    
  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>
    
  5. You can also use the IPageBuilderContext as a constructor dependency elsewhere in your application to more easily determine the state of the current request, without having to use IHttpContextAccessor and all the Kentico Xperience extension methods:

    public class ProductsController
    {
        private readonly IPageBuilderContext context;
    
        public ProductsController(IPageBuilderContext context)
        {
            this.context = context ?? throw new ArgumentNullException(nameof(context));
        }
    
        public ActionResult Index()
        {
            if (context.IsEditMode)
            {
                // ...
            }
    
            if (context.IsLivePreviewMode)
            {
                // ...
            }
    
            if (context.IsLiveMode)
            {
                // ...
            }
    
            if (context.IsPreviewMode)
            {
                // ...
            }
        }
    }
    

References

ASP.NET Core

Kentico Xperience

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 15,373 12/11/2020
1.0.0 420 12/11/2020