1

I am trying to add Kentico's page builder to my application and view the editable area on the CMS side. The steps I followed were:

  1. Creating a content-only page (https://docs.kentico.com/k12sp/developing-websites/defining-website-content-structure/creating-and-configuring-page-types/creating-content-only-page-types)
  2. Registering the page builder (https://docs.kentico.com/k12sp/developing-websites/page-builder-development?utm_source=case&utm_media=CAS-111970-B0S2D0#Pagebuilderdevelopment-Registeringthepagebuilder)
  3. Adding editable areas, sections, and widget zones in my layout

When I open the CMS, I can't see any place to add my widgets. It doesn't show at all. Wondering if there is something I did wrong?

Here is my code:

public class ApplicationConfig
    {
        public static void RegisterFeatures(IApplicationBuilder builder)
        {
            // Enable required Kentico features

            // Uncomment the following to use the Page builder feature

            // Enables the Preview mode functionality, which allows your website editors to preview
            // the content of the MVC site's pages from the Kentico user interface.
            builder.UsePreview();

            // Enables the page builder feature, which allows editors to compose page content via
            // page builder widgets on preconfigured pages.
            builder.UsePageBuilder(new PageBuilderOptions()
            {
                DefaultSectionIdentifier = "GWIC.SingleColumnSection",
                RegisterDefaultSection = false
            });

            builder.UsePageRouting(new PageRoutingOptions
            {
                EnableAlternativeUrls = true
            });
        }
    }

Global.asax.cs

 protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

RouteConfig.cs:

 public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Maps routes to Kentico HTTP handlers and features enabled in ApplicationConfig.cs
            // Always map the Kentico routes before adding other routes. Issues may occur if Kentico URLs are matched by a general route, for example images might not be displayed on pages
            routes.Kentico().MapRoutes();

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new {controller = "Home", action = "Index", id = UrlParameter.Optional}
            );
        }
    }

layout:


<div class="gwic-landing-page">
    <div class="gwic-landing-navigation row">
        <div class="GWICappIcon">
            <div>
                <img src="~/images/gwic_diamond_logo_blue.png" alt="Application" title="Application" height="50" width="50" />
            </div>
            <h1>myNavigator</h1>
        </div>
    </div>

    <div class="gwic-landing-body">
        <div class="gwic-landing-top-section">
            <div class="col-xs-6">
                <div class="section button-grid">
                    @Html.Kentico().EditableArea("gwic-landing-left-column")
                    <section class="section section--padded">
                        <div class="section-inner">
                            @Html.Kentico().WidgetZone()
                        </div>
                    </section>
                </div>
            </div>
            <div class="col-xs-6">
                helpful tools and links area
            </div>
        </div>
    </div>

    <div class="logout-button">
        @Html.ActionLink("Logout", "Logout", "Account", null, new { @class = "btn btn-primary" })
    </div>
</div>

What I am seeing on the CMS: CMS Page View

Hussam Ahmed
  • 413
  • 1
  • 5
  • 17

1 Answers1

0

Where is PageBuilder initialized? I mean the following line typically activates the feature inside an MVC Controller:

// Initializes the page builder with the DocumentID of the page
HttpContext.Kentico().PageBuilder().Initialize(page.DocumentID);