Hello,
I'm trying to implement an Umbraco Package for creating an XML Sitemap.
My logic is that you create a Content item based on a pre-defined Document Type called XMLSitemap, and then using route hijacking I create a custom controller like this:
public class XMLSitemapController : RenderController
My problem is that if I create that controller directly inside my test project everything works as expected, but if I create it inside my package (the code is identical) the controller is not triggered.
Quick update:
I found that changing the controller in the package to
public class XMLSitemapControllerBase : RenderController
And in the test project inheriting from it, like this:
public class XMLSitemapController : XMLSitemapControllerBase
{
public XMLSitemapController(
ILogger<RenderController> logger,
ICompositeViewEngine compositeViewEngine,
IUmbracoContextAccessor umbracoContextAccessor)
: base(logger, compositeViewEngine, umbracoContextAccessor)
{
}
}
with no other additions the code works, but I don't think this is the best solution.
I would rather not have to create an XMLSitemapController in every project where I install this package.
RenderController in package not working
Hello,
I'm trying to implement an Umbraco Package for creating an XML Sitemap.
My logic is that you create a Content item based on a pre-defined Document Type called XMLSitemap, and then using route hijacking I create a custom controller like this:
My problem is that if I create that controller directly inside my test project everything works as expected, but if I create it inside my package (the code is identical) the controller is not triggered.
I guess i'm missing something.
Quick update:
I found that changing the controller in the package to
And in the test project inheriting from it, like this:
with no other additions the code works, but I don't think this is the best solution.
I would rather not have to create an
XMLSitemapController
in every project where I install this package.Hey everyone again.
I was wondering if anyone has some hints on this.
Thanks :)
is working on a reply...