Jacob Khan
Oct 13, 2010
  4577
(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
Multiple Anonymous Carts created from external Head front fetching custom Api

Scenario and Problem Working in a custom headless architecture where a NextJs application hosted in Vercel consumes a custom API built in a...

David Ortiz | Oct 11, 2024

Content Search with Optimizely Graph

Optimizely Graph lets you fetch content and sync data from other Optimizely products. For content search, this lets you create custom search tools...

Dileep D | Oct 9, 2024 | Syndicated blog

Omnichannel Analytics Simplified – Optimizely Acquires Netspring

Recently, the news broke that Optimizely acquired Netspring, a warehouse-native analytics platform. I’ll admit, I hadn’t heard of Netspring before,...

Alex Harris - Perficient | Oct 9, 2024 | Syndicated blog

Problem with language file localization after upgrading to Optimizely CMS 12

Avoid common problems with xml file localization when upgrading from Optimizely CMS 11 to CMS 12.

Tomas Hensrud Gulla | Oct 9, 2024 | Syndicated blog