Try our conversational search powered by Generative AI!

Jacob Khan
Oct 13, 2010
  4490
(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 Data Platform Visitor Groups now supports multiple instances

The module V2.0 now supports multiple Optimizely Data Platform instances, allowing personalized content based on real-time segments and profile dat...

Andrew Markham | May 15, 2024 | Syndicated blog

IP block for edit and admin in DXP

Why IP-blocking edit/admin? A hacker can try to guess user names and passwords to gain access to your site. This risk can be minimized in a couple ...

Daniel Ovaska | May 15, 2024

Do not upgrade to EPiServer.CMS.Core 12.21.4 without reading this!

Todays update of EPiServer.CMS.Core 12.21.4 alters default sort order in an unexpected way, when you are working with muligple languages and have...

Tomas Hensrud Gulla | May 14, 2024 | Syndicated blog

Upgrade Optimizely CMS From v11 to v12

Why Upgrade? There are many improvements implemented in version 12, but most importantly is that the whole framework is migrated from .Net Framewor...

MilosR | May 13, 2024

Configured Commerce - Infrastructure Updates Ahoy!

I'm very happy to share an important milestone - we no longer have any customers in our legacy v1 environment!  This means that the Configured...

John McCarroll | May 10, 2024

A day in the life of an Optimizely Developer - Enabling Opti ID within your application

Hello and welcome to another instalment of A Day In The Life Of An Optimizely developer, in this blog post I will provide details on Optimizely's...

Graham Carr | May 9, 2024