How to get new page class to appear in list of page types in UI?


If you create a hellow world page, e.g:

namespace DxcAlloy.Models.Pages
    [ContentType(DisplayName = "HelloWorld", GUID = "5e4176f9-613d-4c9e-9c85-37dd1d1d70d9", Description = "")]
    public class HelloWorld : PageData

            GroupName = SystemTabNames.Content,
            Order = 10)]
        public virtual ContentArea stuff { get; set; }

It does not appear in the list of pages when you select new page in the CMS editor.  How do we get it added to that list? The page was created with the episerver "page type" Add new item so I am guessing it gerneated a unique GUID.

Jun 22, 2020 6:47

Hi Johnv,

It should appear in the selection. can you make sure that it is available in the admin->content types? (Go to admin and select the content type tab)

And if not then try to recreate it from scratch

Edited, Jun 22, 2020 6:54
johnv - Jun 22, 2020 7:31
Yes, it appears in Admin->ContentType->Page types.

It is possible to limit what page types can be created as children of other pages with specific page types.

In an Alloy site you have something like:

        Include = new[] { typeof(ContainerPage), typeof(ProductPage), typeof(StandardPage), typeof(ISearchPage), typeof(LandingPage), typeof(ContentFolder) }, // Pages we can create under the start page...
        ExcludeOn = new[] { typeof(ContainerPage), typeof(ProductPage), typeof(StandardPage), typeof(ISearchPage), typeof(LandingPage) })] // ...and underneath those we can't create additional start pages

You can also find this in admin mode, select content types and a page type, then "Settings" and "Available page types".

Edited, Jun 22, 2020 7:05
johnv - Jun 22, 2020 7:33
Yep, this was it. In Alloy, the pages you can create are limited to a subset. Which file is "[AvailableContentTypes(" defined? I was able to chaine in the admin UI.
Tomas Hensrud Gulla - Jun 22, 2020 7:39
It can be defined on all content types, see example from the start page in my comment above.

Or you can add this to your content type, to make it available on all other pages:
[AvailableContentTypes(Availability.All, IncludeOn = new[] { typeof(SitePageData)})]

Just add HelloWorld to the Include array, on the pagetypes where you would like to be able to add HelloWorld as a child.

Jun 22, 2020 7:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.