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 Reply Children
  • There's no caching for these routes across plugin reloads... the route collection should be cleared and re-populated every time plugins are reloaded.

    I'd try navigating to your test urls with Chrome Dev Tools up with caching disabled - this also disables its automatic forwarding caching for things like 404s and 301s.