Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Jacob Khan
Oct 13, 2010
  4625
(1 votes)

Add Page Guide from code

Today I got a question from Stephan Kvart who wants to add Page Guides (Quick Publishing) from code. If you are not familiar with the concept of Page guides I recommend reading about it here. He is as many others a PTB user and does not like the idea of adding guides in web.config. Using Reflector and some smart EPiServer people I was able to create page guides from code.

You need to add a reference to this dll EPiServer.Research.PageGuideHelper.dll. Then you can create a class, inherit from PageGuideExtension and add the attribute PageGuideAttribute.

[PageGuideAttribute]
    public class CreateNewsGuide : PageGuideExtension
    {
        public override string Name
        {
            get
            {
                return "Create News";
            }
        }
 
        public override string Title
        {   get
            {
                return "Create News Title";
            }       }
 
        public override string PageTypeName
        {
            get
            {
                return "[Public] News item";
            }
        }
 
        public override EPiServer.Core.PageReference DestinationPage
        {
            get { return new PageReference(4); }
        }
 
        public override System.Collections.Generic.List<string> Properties
        {
            get { return new System.Collections.Generic.List<string> { "PageName", "MainBody" }; }
        }
    }

They are automatically registered and it works well on my machine.

This code is provided as is without support.

Oct 13, 2010

Comments

Please login to comment.
Latest blogs
Level Up with Optimizely's Newly Relaunched Certifications!

We're thrilled to announce the relaunch of our Optimizely Certifications—designed to help partners, customers, and developers redefine what it mean...

Satata Satez | Jan 14, 2025

Introducing AI Assistance for DBLocalizationProvider

The LocalizationProvider for Optimizely has long been a powerful tool for enhancing the localization capabilities of Optimizely CMS. Designed to ma...

Luc Gosso (MVP) | Jan 14, 2025 | Syndicated blog

Order tabs with drag and drop - Blazor

I have started to play around a little with Blazor and the best way to learn is to reimplement some old stuff for CMS12. So I took a look at my old...

Per Nergård | Jan 14, 2025

Product Recommendations - Common Pitfalls

With the added freedom and flexibility that the release of the self-service widgets feature for Product Recommendations provides you as...

Dylan Walker | Jan 14, 2025