November Happy Hour will be moved to Thursday December 5th.

Jacob Khan
Oct 13, 2010
  4596
(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
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog