Plug-in that acts like content page

Is there a way to create a plug-in that acts like a content page? I would like to add a route, but every page that renders under that route has its own configuration

/key1/{page key1}

/key1/{page key}

one route, but have different widgets on each page

Parents Reply
  • Here is what I have for a working POC.
    Plugin is configurable - takes XML as input.
    Plugin reads the XML and registers routes based on the XML
    Plugin creates empty pages for each route.  
    Route actually gets refreshed/added when the configuration is updated, no need to dsable/re-enable the plugin.

    This is intended to create custom blank pages for the purpose of building out a custom content page.  Almost exactly like themed content pages, but without the /p/ in the URL

    Here is the plugin - very rough, but works.  Anything here that could get me into trouble???

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml;
    using System.Xml.Linq;
    using Telligent.DynamicConfiguration.Components;
    using Telligent.Evolution.Extensibility.Urls.Version1;
    using Telligent.Evolution.Extensibility.Version1;
    
    namespace SampleNamespace.CMS
    {
        public class CMSPlugin : IPlugin, IConfigurablePlugin, INavigable
        {
            private IPluginConfiguration _config;
            public const string ROUTE_XML_CONFIG_KEY = "routeXml";
    
            #region IPlugin Members
            public string Description
            {
                get
                {
                    return "Implements custom dynamic routes for CMS pages";
                }
            }
    
            public string Name
            {
                get
                {
                    return "CMS Plugin";
                }
            }
    
            public void Initialize()
            {
                
            }
            #endregion
            #region IConfigurablePlugin Members
            public PropertyGroup[] ConfigurationOptions
            {
                get
                {
                    // Options
                    var group = new PropertyGroup("options", "Options", 0);
    
                    // XML
                    var xml = new Property(ROUTE_XML_CONFIG_KEY, "Custom Routes XML", PropertyType.String, 1, string.Empty)
                    {
                        DescriptionText = "XML Document defining custom CMS page routes",
                        ControlType = typeof(Telligent.DynamicConfiguration.Controls.MultilineStringControl)
                    };
                    group.Properties.Add(xml);
    
                    return new[] { group };
                }
            }
    
            public void Update(IPluginConfiguration configuration)
            {
                _config = configuration;
            }
    
            public string GetConfigurationString(string key)
            {
                return _config.GetString(key);
            }
            #endregion
    
            #region INavigable Members
            public void RegisterUrls(IUrlController controller)
            {
                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(this.GetConfigurationString(ROUTE_XML_CONFIG_KEY));
    
                    var routes = doc.GetElementsByTagName("Route");
                    foreach (XmlNode route in routes)
                    {
                        controller.AddPage(route.SelectSingleNode("key").InnerText, route.SelectSingleNode("route").InnerText, null, null, route.SelectSingleNode("key").InnerText, new PageDefinitionOptions() { });
                    }
                }
                catch { }
            }
            #endregion
        }
    }
    

    <?xml version="1.0" encoding="utf-8"?>
    <Routes>
      <Route>
        <key>my-page-one</key>
        <route>my-page-one</route>
      </Route>
      <Route>
        <key>page-one-links</key>
        <route>my-page-one/links</route>
      </Route>
    </Routes>

Children
No Data