Jacob Khan
Oct 13, 2010
  4761
(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
Avoid Scandinavian Letters in File Names in Optimizely CMS

Discover how Scandinavian letters in file names can break media in Optimizely CMS—and learn a simple code fix to automatically sanitize uploads for...

Henning Sjørbotten | Jun 19, 2025 |

Exporting Optimizely databases causing errors

Solutions to a couple of recurring issues when migrating databases to the cloud.

Tomas Hensrud Gulla | Jun 18, 2025 |

Common Pitfalls with Search in Optimizely Graph - and How to Avoid Them

Optimizely Graph offers powerful, flexible search capabilities out of the box, making it a popular choice for headless implementations. However, li...

Michał Mitas | Jun 18, 2025

Introducing the Feature Experimentation Administrator Certification

We’re excited to announce the launch of the  Feature Experimentation Administrator Certification,  the newest addition to our growing suite of...

Satata Satez | Jun 18, 2025

UrlResolver Bug in Optimizely DXP: Troubleshooting Inconsistent URLs in Scaled-Out Apps

A while back, our team encountered a puzzling production bug: URLs generated by the UrlResolver would randomly differ depending on who accessed the...

David Drouin-Prince | Jun 18, 2025 |

Optimizely Commerce Connect: Enabling content-driven ecommerce experiences

The world of ecommerce today is a rapidly evolving field. No longer are customers satisfied with a long list of products that they have no idea how...

Shahrukh Ikhtear | Jun 16, 2025