Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 14, 2022 @ 08:33
    Andreas Kristensen
    0

    Activating XML sitemap disables custom XML sitemaps

    I am working on a site, where I need to generate an XML sitemap of some virtual nodes on the fly. I have made a controller and all the stuff, and it works. But when I turn on the XML sitemap setting in SEOChecker v9, it stops working. I now get a 404 on my controller. So there is something in SEOChecker that is clashing with my code. But I don't know what. I have tried renaming the controller. but to no avail. Any ideas on how to use the XML sitemap functionality in SEOChecker together with a custom XML sitemap?

    Here is my composer:

    public class XmlSitemapComposer : IComposer
        {
            public void Compose(IUmbracoBuilder builder)
            {
                builder.Services.Configure<UmbracoPipelineOptions>(options =>
                {
                    options.AddFilter(new UmbracoPipelineFilter(nameof(XmlSitemapController))
                    {
                        Endpoints = app => app.UseEndpoints(endpoints =>
                        {
                            endpoints.MapControllerRoute("Sitemap Index", "sitemapindex.xml", new { Controller = "XmlSitemap", Action = "SitemapIndex" });
    
                            endpoints.MapControllerRoute("References sitemap", "referencesSitemap.xml", new { Controller = "XmlSitemap", Action = "ReferencesSitemap" });
                        })
                    });
                });
            }
        }
    
  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 14, 2022 @ 08:36
    Richard Soeteman
    0

    Hi Andreas,

    Disable my xmlsitemap indeed otherwise Middleware will take over. What are you trying to do?

    Best,

    Richard

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 14, 2022 @ 08:38
    Andreas Kristensen
    0

    Hi Richard,

    What I intended to do, was to have a sitemap index, that would link to the SEOChecker XML sitemap and the custom "References sitemap". We had done so in another project, but that was a v8 solution, so it's possible that the same way of doing it is not possible in v9. I would like to still use the SEOChecker XML sitemap functionality, so I don't have to code a new sitemap.

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 15, 2022 @ 09:13
    Richard Soeteman
    0

    Hi Andreas,

    You could create such functionality as long as your custom solution doesn't end with sitemapindex.xml and sitemap.xml. For sitemap.xml there are notifications you can use to add extra nodes. Might be a good idea to have those for sitemapindex.xml as well.

    Best,

    Richard

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 15, 2022 @ 10:01
    Andreas Kristensen
    0

    Hi Richard,

    Oh yes, you are right, it works if I change the name of the endpoints. But it might be a better solution to hook into the sitemap generated by SEOChecker. Where would I find info about those notification?

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 15, 2022 @ 15:45
    Richard Soeteman
    0

    Murphys law :-)

    I thought it was already in the manual, will add it soon and fix the namespace issue in 9.1

    In SEOChecker.Library.Notifications.Notifications you see a few notifications one is XmlSitemapGeneratingNotification/XmlSitemapGeneratedNotification that allows you to add Nodes to the xitemap during rendering.

    Hope this helps.

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 16, 2022 @ 09:53
    Andreas Kristensen
    0

    Awesome. But how do I get the XML Sitemap properties from SEOChecker that is on the node? It just resolves as an 'object' when models are generated.

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 16, 2022 @ 10:11
    Andreas Kristensen
    0

    When generating the sitemap, this error is throw, and the sitemap is empty. The notification handler I added is not even hit. Not really much info to go by. enter image description here

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Feb 16, 2022 @ 10:14
    Andreas Kristensen
    0

    Also: This is a multi-site and multi-lingual site. So two root noted that are different sites, and they are in different languages. Also: The other sites, in other languages, just return a 404 when I try to see their sitemap: example: domain.localhost/da/sitemap.xml for Danish.

  • Andreas Kristensen 65 posts 269 karma points c-trib
    Apr 19, 2022 @ 11:56
    Andreas Kristensen
    0

    Hi Richard,

    I am still experiencing the same error: "Error in XML Sitemap for node 1238" (that is the root node), and I have no idea what to do. I have upgraded Umbraco to latest, even tried they new SeoChecker v9 beta, but I still end up with an empty XML sitemap and an error in the log.

    Any ideas? Any info I can provide? Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft