Routed pages using AddPage getting cached somehow?

We've been setting up a bunch of custom (routed) pages in plugin code, and we're using a content fragment to add specific widgets to these pages. To make life easier, I've added a function to help us do this without defining a load of individual XML strings for each widget, but apart from that it's pretty much following your examples.

One thing I ran across yesterday on my local PC (devmode=true) was I first had one of the routed pages set to the wrong ID & nothing was being output, so I corrected the Widget GUID but it still didn't show the widget.

In the end (clutching at straws) I changed the internal names to add a version to the end of the string (but didn't change the routing URL)..

This ended up working!

So where is it caching this setup? I'd rebooted the whole PC & it still didn't clear it, so it can't be a memory cache.

I've included my full code below.

using Telligent.Evolution.Extensibility.Urls.Version1;

namespace Something.CustomPages
{
    public class CustomPages : INavigable
	{
		public string Name => "Custom Pages";
		public string Description => "Custom Pages";
		public void Initialize() { }

        void INavigable.RegisterUrls(IUrlController controller)
        {
            // First parameter must be unique amongst all other pages
            // Second parameter is the URL
            // Fifth is the human-readable page title.. this might be visible in the Custom Pages panel, but isn't visible to the users
            // Sixth is generally a call to GetSinglePageWidgetDefinition.. the first param is a repeat of the unique page name but doesn't seem to matter
            //                                                              second param is the widget GUID

            controller.AddPage("e14-cookies8", "about-cookies", null, null, "e14 About Cookies8", GetSinglePageWidgetDefinition("e14-cookies8", "8c32bca5-4437-414a-8ebb-3460accf9941"));


            // SINGLE PAGE WIDGET

            // Helper method that simplifies adding a single widget to a custom page
            PageDefinitionOptions GetSinglePageWidgetDefinition(string PageName, string WidgetGUID)
            {
                return new PageDefinitionOptions
                {
                    HasApplicationContext = false,
                    SetCustomPageOutput = (context, outputController) => { },
                    ParseContext = (context) => { },
                    Validate = (context, accessController) => { },
                    DefaultPageXml = GetSinglePageWidgetFragment(PageName, WidgetGUID)
                };
            }

            // Return a standard XML fragment that represents a single widget on a page
            string GetSinglePageWidgetFragment(string PageName, string WidgetGUID)
            {
                WidgetGUID = WidgetGUID.Replace("-", "");

                return $@"<contentFragmentPage pageName=""{PageName}"" isCustom=""false"" layout=""Content"">
                    <regions>
                      <region regionName=""Content"" >
                        <contentFragments>
                          <contentFragment type=""Telligent.Evolution.ScriptedContentFragments.ScriptedContentFragment, Telligent.Evolution.Platform::{WidgetGUID}"" showHeader=""False"" cssClassAddition=""no-wrapper with-spacing responsive-1"" isLocked=""False"" configuration="""" />
                        </contentFragments>
                      </region>
                    </regions>
                    <contentFragmentTabs />
                  </contentFragmentPage>";
            }
        }
	}
}

Parents
  • Page routes are added to the route collection when plugins are loaded/reloaded, so ensure this happens when changes are made (should happen if dll changes occur, but best to confirm.)

    Routes are only added to the collection when the UrlName (first parameter) does not conflict with another route already added, and when the Url itself and its Constraints and Defaults (2nd, 3rd, and 4th parameters) do not match to an existing route. If you are seeing duplicate or not seeing something you expect, ensure all these things are unique so the the page is added to the controller as expected.

  • They're definitely unique amongst the other pages/routes we've defined. But from what I've seen they're getting saved somewhere outside of just the DLL or memory caches. So as far as you're aware, the platform doesn't save these routes in the database or somewhere else.. it's purely via the DLL which is processed on system startup?

Reply Children