Try our conversational search powered by Generative AI!

Lee Crowe
Jun 17, 2011
(5 votes)

Introducing EPiServer PageTypeExtensions v1.0

A few months ago I was working on a project that had the requirement to restrict the number of pages of specific types that could be created beneath a page of a specific type.

I also had a need to not allow any pages under a page type.  But EPiServer currently doesn’t support this.  If you don’t explicitly select available page types then all page types will be available.

A couple of weeks ago I decided to revisit the code I wrote for this and make it available via an open source project.

The restrictions were enforced by hooking into DataFactory events such as creating, moving, saving, and publishing pages.

I decided to enhance the functionality and create a new version of the NewPage.aspx page.  This page would filter the available page types by checking the various configured restrictions.

After I implemented the necessary functionality for page type restrictions I recalled a blog post David Knipe wrote a year ago about enhancing the Create New Screen.  I thought while I was on the subject of building something that replaces the Create New page I could bolt in some thumbnail and preview image functionality.

Setup and Installation

Please refer to this document for detailed instructions on setup and usage.  The runtime binaries and source code can be downloaded from codeplex.


Below I will give a quick summary on the features available and how to use them.  Please refer to this document for more detailed instructions on how to use the features available.

Page Type Restrictions

The page type restrictions functionality is dependent on PageTypeBuilder and allows a developer to restrict page types that can be created under particular page types.  The rules can be setup by decorating page type classes with PageTypeRestriction attributes.  Examples are below:

1. Specify that no children can be created under a page type named “Parent”.

[PageTypeRestriction(NumberOfAllowedChildren = 0)]
public class Parent : TypedPageData

2. Specify that a total of 5 pages can be created under a page type named “Parent”.

[PageTypeRestriction(NumberOfAllowedChildren = 5)]
public class Parent : TypedPageData

3. Specify that no instances of a page type named “Child” can be created under a page type named “Parent”.

[PageTypeRestriction(ChildPageTypeTypes = new[] { typeof(Child) }, NumberOfAllowedChildren = 0)]
public class Parent : TypedPageData

4. Specify that only 5 instances of a page type named “Child” and 1 instance of a page type named “ChildTwo” can be created under a page type named “Parent”.

[PageTypeRestriction(ChildPageTypeTypes = new[] { typeof(Child) }, NumberOfAllowedChildren = 5)]
[PageTypeRestriction(ChildPageTypeTypes = new[] { typeof(ChildTwo) }, NumberOfAllowedChildren = 1)]
public class Parent : TypedPageData

5. Specify that only 5 instances of a page type named “Child” and a page type named “ChildTwo” can be created under a page type named “Parent”.

[PageTypeRestriction(ChildPageTypeTypes = new[] { typeof(Child), typeof(ChildTwo) }, 
        NumberOfAllowedChildren = 5)]
public class Parent : TypedPageData


Thumbnail and Preview Images on Create New Page

This is a feature more people will probably be interested in.  There are many configuration settings that can be configured within the PageTypeExtensions.config file (please refer to usage instructions for more information) which allow you to configure thumbnail and preview images for the create new  page.

Put simply the new version of the create new page will get page type thumbnail and preview images from the VPP.

There is a scheduled job, an administration tool and right click tree view functionality which can be exploited to allow automatic generation of web page images.

Web page images are generated using IECapt but alternative capture tools/web services could be used by modifying the value of the webPageImageGeneratorType configuration attribute.

When creating images for page types, by default the last published page saved of a particular page type will be used for the image capture. It is possible to specify a particular page of a particular page type to use for the image capture. You can do this by adding a Boolean property to your page type with the same name as the value defined in the useForImagePreviewPropertyName configuration attribute. The editor then needs to set this property value to true on the page they want to use. If no page can be found with the property value set to true then the latest published save page will be used.

Examples of the updated NewPage.aspx which is used for creating pages from page types are shown below:



I am always eager to receive feedback good and bad. 

Please feel free to email or twitter me with any feedback @croweman or comment on the blog post Smile


Although I have tested the assembly and am happy with it’s functioning there may well be little bugs that I have not spotted.  Please give it a thorough test before releasing it to the production environment and log any issues on codeplex.

Jun 17, 2011


Joshua Folkerts
Joshua Folkerts Jun 17, 2011 04:25 PM

Very nice.

Jun 18, 2011 12:12 AM

Yes very nice! Maybe something you can incorporate with your tab-ordering Joshua?

Joshua Folkerts
Joshua Folkerts Jun 23, 2011 04:00 AM

Most certainly.

Please login to comment.
Latest blogs
Optimizely Web... 6 Game Changing Features in 2024

If you are interested in learning about what's new within Optimizely Web, you are in the right place. Carry on reading to learn about the 6 greates...

Jon Jones | Mar 3, 2024 | Syndicated blog

Headless forms reloaded (beta)

Forms is used on the vast majority of CMS installations. But using Forms in a headless setup is a bit of pain since the rendering pipeline is based...

MartinOttosen | Mar 1, 2024

Uploading blobs to Optimizely DXP via PowerShell

We had a client moving from an On-Prem v11 Optimizely instance to DXP v12 and we had a lot of blobs (over 40 GB) needing uploading to DXP as a part...

Nick Hamlin | Mar 1, 2024 | Syndicated blog

DbLocalizationProvider v8.0 Released

I’m pleased to announce that Localization Provider v8.0 is finally out.

valdis | Feb 28, 2024 | Syndicated blog

Epinova DXP deployment extension – With Octopus deploy

Example how you can use Epinova DXP deployment extension in Octopus deployment.

Ove Lartelius | Feb 28, 2024 | Syndicated blog

Identify Azure web app instance id's for an Optimizely CMS site

When running Optimizely CMS in Azure, you will be using an instance bound cloud license. What instances are counted, and how can you check them? Le...

Tomas Hensrud Gulla | Feb 27, 2024 | Syndicated blog