我正在尝试将 Kentico 的页面构建器添加到我的应用程序并查看 CMS 端的可编辑区域。我遵循的步骤是:
- 创建仅内容页面(https://docs.kentico.com/k12sp/developing-websites/defining-website-content-structure/creating-and-configuring-page-types/creating-content-only-page-types )
- 注册页面构建器(https://docs.kentico.com/k12sp/developing-websites/page-builder-development?utm_source=case&utm_media=CAS-111970-B0S2D0#Pagebuilderdevelopment-Registeringthepagebuilder)
- 在我的布局中添加可编辑区域、部分和小部件区域
当我打开 CMS 时,我看不到任何可以添加小部件的地方。它根本不显示。想知道是不是我做错了什么?
这是我的代码:
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
});
}
}
全球.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}
);
}
}
布局:
<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>
我在 CMS 上看到的内容: CMS 页面视图